做了一个左侧广告条随滚动条上下移动也随着一起移动的html代码?我已经写好了,按书本的。但是不能用。
代码如下,请问哪错了,求高手指点,谢谢。<html><head><title></title><scripttype="text/javascript">varadvIn...
代码如下,请问哪错了,求高手指点,谢谢。
<html>
<head>
<title></title>
<script type="text/javascript">
var advInitTop=0;
function move() {
document.getElementById("advLayer").style.PixelTop=advInitTop+document.body.scrollTop;
}
window.onscroll=move;
</script>
</head>
<body>
<div id="advLayer" style="position:fixed;left:16px;top:129px; width:180px;height:230px;z-index:1;">
<img src="图片/5.jpg" width="180" height="230">
</div>
<p> </p>
<p><img src="图片/Lenovo_11.jpg" width="993" height="1799"></p>
<p> </p>
</body>
</html>
fixed改为:absolute
我的目的是让广告条随滚动条移动而移动的,请大家帮帮我,谢谢 展开
<html>
<head>
<title></title>
<script type="text/javascript">
var advInitTop=0;
function move() {
document.getElementById("advLayer").style.PixelTop=advInitTop+document.body.scrollTop;
}
window.onscroll=move;
</script>
</head>
<body>
<div id="advLayer" style="position:fixed;left:16px;top:129px; width:180px;height:230px;z-index:1;">
<img src="图片/5.jpg" width="180" height="230">
</div>
<p> </p>
<p><img src="图片/Lenovo_11.jpg" width="993" height="1799"></p>
<p> </p>
</body>
</html>
fixed改为:absolute
我的目的是让广告条随滚动条移动而移动的,请大家帮帮我,谢谢 展开
展开全部
<script type="text/javascript">
var advInitTop=129
function move(){
document.getElementById("advLayer").style.top=(advInitTop+document.body.scrollTop)+"px";
}
window.onscroll=window.onresize=move;
</script>
或:
<script type="text/javascript">
var advInitTop=129
function movett(){
document.getElementById("advLayer").style.top=(advInitTop+document.body.scrollTop)+"px";
window.setTimeout(movett,80)
}
window.onload=movett;
</script>
var advInitTop=129
function move(){
document.getElementById("advLayer").style.top=(advInitTop+document.body.scrollTop)+"px";
}
window.onscroll=window.onresize=move;
</script>
或:
<script type="text/javascript">
var advInitTop=129
function movett(){
document.getElementById("advLayer").style.top=(advInitTop+document.body.scrollTop)+"px";
window.setTimeout(movett,80)
}
window.onload=movett;
</script>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询