2个回答
展开全部
<html>
<head>
<title>广告滚动</title>
<script>
var advInitTop=0;
var closeInitTop=0;
function init(){
advInitTop=document.getElementById("advLayer").style.pixelTop;
closeInitTop=document.getElementById("closeLayer").style.pixelTop;
}
function move(){
document.getElementById("advLayer").style.pixelTop=
advInitTop+document.body.scrollTop;
document.getElementById("closeLayer").style.pixelTop=
closeInitTop+document.body.scrollTop;
window.onscroll=move;
}
function closeMe( ) {
document.getElementById("closeLayer").style.display="none";
document.getElementById("advLayer").style.display="none"; }
window.onscroll=move ;
</script>
</head>
<body onload="init()">
<img src="images/top.jpg">
<img src="images/content1.jpg">
<img src="images/content2.jpg">
<img src="images/foot.jpg">
<div id="advLayer" style="position:absolute; left:16px;
top:129px; width:144px; height:95px; z-index:1;">
<img src="images/left.jpg">
</div>
<div id="advLayer" style="position:absolute; right:16px;
top:129px; width:144px; height:95px; z-index:1;">
<img src="images/right.jpg">
</div>
<div id="closeLayer" onclick="closeMe( )"
style="position:absolute;left:166px;top:132px;width:27px;
height:19px;z-index:2;">
<img src="images/close.png" width="26" height="18"></div>
</body>
</html>
<head>
<title>广告滚动</title>
<script>
var advInitTop=0;
var closeInitTop=0;
function init(){
advInitTop=document.getElementById("advLayer").style.pixelTop;
closeInitTop=document.getElementById("closeLayer").style.pixelTop;
}
function move(){
document.getElementById("advLayer").style.pixelTop=
advInitTop+document.body.scrollTop;
document.getElementById("closeLayer").style.pixelTop=
closeInitTop+document.body.scrollTop;
window.onscroll=move;
}
function closeMe( ) {
document.getElementById("closeLayer").style.display="none";
document.getElementById("advLayer").style.display="none"; }
window.onscroll=move ;
</script>
</head>
<body onload="init()">
<img src="images/top.jpg">
<img src="images/content1.jpg">
<img src="images/content2.jpg">
<img src="images/foot.jpg">
<div id="advLayer" style="position:absolute; left:16px;
top:129px; width:144px; height:95px; z-index:1;">
<img src="images/left.jpg">
</div>
<div id="advLayer" style="position:absolute; right:16px;
top:129px; width:144px; height:95px; z-index:1;">
<img src="images/right.jpg">
</div>
<div id="closeLayer" onclick="closeMe( )"
style="position:absolute;left:166px;top:132px;width:27px;
height:19px;z-index:2;">
<img src="images/close.png" width="26" height="18"></div>
</body>
</html>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
到 懒人图库 JS广告代码非常多,可以找到你需要的。
参考资料: http://www.lanrentuku.com/js/
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询