浮动广告条的问题
今天 帮一刚学js的人 找浮动广告错误 。懒的找 直接自己打了遍 。怎么看 都没错误,不知道 哪部对了。不能同滚动条 滚动。只同时隐藏可以。老手 过来 看下。<html>
<head>
<script language="javascript">
var advTop=0;
var closeTop=0;
function inix(){
advTop=document.getElementById("advLayer1").style.pixelTop;
closeTop=document.getElementById("advLayer2").style.pixelTop;
}
function move(){
document.getElementById("advLayer1").style.pixelTop=advTop+document.body.scrollTop;
document.getElementById("advLayer2").style.pixelTop=closeTop+document.body.scrollTop;
}
function closeMe(){
document.getElementById("advLayer1").style.display="none";
document.getElementById("advLayer2").style.display="none";
}
window.onscroll=move;
</script>
</head>
<body onLoad="inix()">
<div id="advLayer1" style="position:absolute; left:6px;top:38px;width:27px;height:153px;z-index:1;">
<img src="fudong.jpg" width="193" height="153" border="0"">
</div>
<div id="advLayer2" onClick="closeMe()" style="position:absolute; left:235px;top:42px;width:38px;height:31px;z-index:2">
<img src="xunlei.jpg" width="38" height="31" border="0">
</div>
<pre>
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
11
1
1
1
1
1
1
1
11
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
11
1
1
1
1
1
1
1
11
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
11
1
1
1
1
1
1
1
11
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
11
1
1
1
1
1
1
1
1
</pre>
</body>
</html>
[[it] 本帖最后由 endspay 于 2009-7-25 11:31 编辑 [/it]]
fudong.rar
(868 Bytes)