新微赢技术网

标题: [求助]图片跟随窗口上下移动的问题 [打印本页]

作者: 绝不放弃    时间: 2010-1-15 03:40
标题: [求助]图片跟随窗口上下移动的问题
小弟想实现图片跟随窗口上下移动,编写了以下代码,在局域网中测试一切正常,但传在网上却出现“对象为空或不存在”的错误,请各位前辈指点一下,谢谢。

以下代码加在<head></head>区域

<style TYPE="text/css">
#banmian {
position: absolute;
left: 0;
top: 0;
visibility: visible;
z-index: 10;
}
#lashou {
position: absolute;
left: 900;
top: 0;
visibility: visible;
z-index: 10;
}
#zangao{
position: absolute;
left: 0;
top: 200;
visibility: visible;
z-index: 10;
}
#cuiji{
position: absolute;
left: 900;
top: 200;
visibility: visible;
z-index: 10;
}
</style>



以下代码加在<body></body>区域

<script language="JavaScript">
function fudongguangao()
{
h = document.body.scrollTop;
document.all.banmian.style.pixelTop = h;
document.all.lashou.style.pixelTop = h;
document.all.zangao.style.pixelTop = h + 200;
document.all.cuiji.style.pixelTop = h + 200;
}
</script>

window.setInterval("fudongguangao()",500);
<div ID="banmian"><img SRC="guanggao/banmian.gif" width="90" height="190"><br></div>
<div ID="lashou"><img SRC="guanggao/lashou.jpg"><br></div>
<div ID="zangao"><a href="http://www.jzza6688.com" target="_blank"><img SRC="guanggao/zangao.jpg" width="90" height="170"></a><br></div>
<div ID="cuiji"><img SRC="guanggao/cuiji.jpg" width="90" height="190"><br></div>
作者: 妈妈猪的一天    时间: 2010-1-15 03:40
对不起
window.setInterval("fudongguangao()",500);
代码应该在<script language="JavaScript"></script>之内,是我上传时写错了。




欢迎光临 新微赢技术网 (http://bbs.weiying.cn/) Powered by Discuz! X3.2