小弟想实现图片跟随窗口上下移动,编写了以下代码,在局域网中测试一切正常,但传在网上却出现“对象为空或不存在”的错误,请各位前辈指点一下,谢谢。
以下代码加在<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>