设为首页收藏本站

Scripts 学盟

 找回密码
 加入学盟

QQ登录

只需一步,快速开始

查看: 1792|回复: 5
打印 上一主题 下一主题

同一个JS在不同的页面为何显示不一样 [复制链接]

Rank: 9Rank: 9Rank: 9

跳转到指定楼层
1#
莺子 发表于 2011-6-30 08:45:01 |只看该作者 |倒序浏览
不能的页面调用同一个JS,显示出来的位置效果啥不一样呢
http://www.zg1929.com/baoming.html  变居中了
http://www.zg1929.com/xly.htm  居中的为正确的

JS代码如下:
document.write("<DIV id=divStay style=\"position:absolute; right:0;\"> ");
document.write("<TABLE cellSpacing=0 cellPadding=0 width=\"100%\" border=0> ");
document.write("<TBODY> ");
document.write("<TR> ");
document.write("<TD vAlign=top width=\"7%\"> </TD></TR></TBODY></TABLE></DIV> ");
document.write("<div id=\"divStayTopleft\" style=\"POSITION: absolute\"> ");
document.write("<table cellspacing=\"0\" cellpadding=\"0\" width=\"109\" border=\"0\"> ");
document.write("<tr> ");
document.write("<td colspan=\"3\"> ");
document.write("<a onClick=\"CloseQQ()\" href=\"javascript:;\" shape=\"circle\" coords=\"91,16,12\"> ");
document.write("<img height=\"34\" src=\"http://www.zg1929.com/templets/default/tybm_img/qq_top.gif\" width=\"109\" usemap=\"#Map\" border=\"0\"></a></td> ");
document.write("</tr> ");
document.write("<tr> ");
document.write("<td width=\"6\"><img height=\"130\" src=\"http://www.zg1929.com/templets/default/tybm_img/qq_life.gif\" width=\"6\"></td> ");
document.write("<td width=\"96\" valign=\"top\" background=\"sto/qq_bg.gif\" bgcolor=\"#FFFFFF\"> ");
document.write("<table cellspacing=\"0\" cellpadding=\"0\" width=\"90\" align=\"center\" border=\"0\"> ");
document.write("<tr> ");
document.write("<td height=\"30\"> ");
document.write("<table cellspacing=\"0\" cellpadding=\"0\" width=\"90\" border=\"0\"> ");
document.write("<tr> ");
document.write("<td> ");
document.write("<img height=\"13\" src=\"http://www.zg1929.com/templets/default/tybm_img/qq_ico1.gif\" width=\"16\"><span class=\"font_12\"> ");
document.write("<span style=\"font-size: 9pt\">客户服务</span></span></td> ");
document.write("</tr> ");
document.write("</table> ");
document.write("</td> ");
document.write("</tr> ");
document.write("<tr> ");
document.write("<td> ");
document.write("<table border=\"0\" width=\"100%\" cellpadding=\"2\" id=\"table47\"> ");
document.write("<tr> ");
document.write("<td height=\"23\" valign=\"bottom\"><script>document.write(\"<a target=blank href=tencent://message/?uin=200971929&Site=红色体验游客服&Menu=yes><img border=0 SRC=http://wpa.qq.com/pa?p=1:200971929:10 alt=[红色体验游客服]></a>\");</script></td> ");
document.write("</tr> ");
document.write("</table> ");
document.write("</td> ");
document.write("</tr>");
document.write("<tr> ");
document.write("<td> ");
document.write("<table border=\"0\" width=\"100%\" cellpadding=\"2\" id=\"table47\"> ");
document.write("<tr> ");
document.write("<td height=\"23\" valign=\"bottom\"><script>document.write(\"<a target=blank href=tencent://message/?uin=1824983759&Site=红色体验游客服&Menu=yes><img border=0 SRC=http://wpa.qq.com/pa?p=1:1824983759:10 alt=[红色体验游客服]></a>\");</script></td> ");
document.write("</tr> ");
document.write("</table> ");
document.write("</td> ");
document.write("</tr> ");
document.write("<tr> ");
document.write("<td></td> ");
document.write("</tr> ");
document.write("<tr> ");
document.write("<td> ");
document.write("<table border=\"0\" width=\"100%\" cellpadding=\"2\" id=\"table47\"> ");
document.write("<tr> ");
document.write("<td height=\"23\" valign=\"bottom\"><script>document.write(\"<a target=blank href=tencent://message/?uin=2268135697&Site=红色体验游客服&Menu=yes><img border=0 SRC=http://wpa.qq.com/pa?p=1:2268135697:10 alt=[红色体验游客服]></a>\");</script></td> ");
document.write("</tr> ");
document.write("</table> ");
document.write("</td> ");
document.write("</tr> ");
document.write("<tr> ");
document.write("<td></td> ");
document.write("</tr> ");
document.write("</table> ");
document.write("</td> ");
document.write("<td width=\"7\"><img height=\"130\" src=\"http://www.zg1929.com/templets/default/tybm_img/qq_right.gif\" width=\"7\"></td> ");
document.write("</tr> ");
document.write("<tr> ");
document.write("<td colspan=\"3\"> ");
document.write("<img height=\"30\" src=\"http://www.zg1929.com/templets/default/tybm_img/qq_bottom1.gif\" width=\"109\"></td> ");
document.write("</tr> ");
document.write("<tr> ");
document.write("<td colspan=\"3\"> ");
document.write("<img height=\"33\" src=\"http://www.zg1929.com/templets/default/tybm_img/qq_logo.gif\" width=\"109\"></td> ");
document.write("</tr> ");
document.write("</table> ");
document.write("</div> ");

function picsize(obj,MaxWidth){
img=new Image();
img.src=obj.src;
if (img.width>MaxWidth)
{
return MaxWidth;
}
else
{
return img.width;
}
}
function CloseQQ()
{
divStayTopleft.style.display="none";
return true;
}
var online= new Array();

function FloatTop()

{

        function offsetWidth() {

                return document.documentElement.offsetWidth||document.body.offsetWidth;   

        }

        function scrollTop() {

                return document.documentElement.scrollTop||document.body.scrollTop;   

        }

        function scrollLeft() {

                return document.documentElement.scrollLeft||document.body.scrollLeft;   

        }

        var startX1 =offsetWidth()-125 ,startY1 = 5;

        var startX2 =0,startY2 = 95;

        var ns = (navigator.appName.indexOf("Netscape") != -1);

        var d = document;

        function ml(id,startX,startY)

        {

                var el=document.getElementById(id);

                el.sP = function(x,y){ /*this.style.left=x+"px";*/this.style.top=y+"px"; };

                /*el.x = startX; */

                el.y = startY;

                return el;

        }

        window.stayTopLeft=function()

        {

                var pY = ns ? pageYOffset : scrollTop();

                ftlObj.y += (pY + startY1 - ftlObj.y)/8;

                ftlObj1.y += (pY + startY2 - ftlObj1.y)/8;

                ftlObj.sP(scrollLeft()+offsetWidth()-125, ftlObj.y);

                ftlObj1.sP(ftlObj1.x, ftlObj1.y);

                setTimeout("stayTopLeft()", 30);

        }

        // ftlObj = ml("divStay",document.body.scrollLeft+document.body.offsetWidth-125,0);

        // ftlObj1 = ml("divStayTopLeft",0,30);

        ftlObj = ml("divStay",(scrollLeft()+offsetWidth())/2+379,0);

        ftlObj1 = ml("divStayTopleft",(scrollLeft()+offsetWidth())/2+520,30);

        stayTopLeft();

}

FloatTop();
分享到: QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
分享分享0 收藏收藏0

管理员

超级大菜鸟

Rank: 9Rank: 9Rank: 9

2#
混混@普宁.中国 实名认证  发表于 2011-6-30 09:22:32 |只看该作者
css 或者 style 下手,
  1. document.write("<div id=\"divStayTopleft\" style=\"POSITION: absolute; right:0; width:109px;\"> ");
复制代码

使用道具 举报

Rank: 9Rank: 9Rank: 9

3#
莺子 发表于 2011-6-30 09:54:16 |只看该作者
不行啦,放上去,直接就置底了

使用道具 举报

管理员

超级大菜鸟

Rank: 9Rank: 9Rank: 9

4#
混混@普宁.中国 实名认证  发表于 2011-6-30 10:12:37 |只看该作者
肯定是哪里改错了。。。破坏了 dom 结构

使用道具 举报

Rank: 9Rank: 9Rank: 9

5#
莺子 发表于 2011-6-30 10:14:06 |只看该作者
弄错位置了,不过还是改成left:0好了。为什么IE有那么多版本,为什么机器有那么多分辨率

使用道具 举报

Rank: 9Rank: 9Rank: 9

6#
浴火凤凰 发表于 2011-6-30 13:58:09 |只看该作者
为什么这个世界要有那么多的浏览器?
为什么该死的世界之窗和360说是使用的IE内核却和IE表现的不一样。。。

使用道具 举报

您需要登录后才可以回帖 登录 | 加入学盟

手机版|Scripts 学盟   |

GMT+8, 2024-5-2 14:46 , Processed in 1.055106 second(s), 11 queries .

Powered by Discuz! X2

© 2001-2011 Comsenz Inc.

回顶部