<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style type="text/css" >
#divCenter{
margin:0px auto;
width:1000px;
border:1px solid red;
}
#divA{
position:absolute;
z-index:9px;
top:50px;
left:50px;
}
#divImg{
position:absolute;
z-index:10px;
top:0px;
right:0px;
}
</style>
<script type="text/javascript" language="javascript">
window.οnscrοll=function(){
var top=document.documentElement.scrollTop||window.pageYOffset||document.body.scrollTop;
//var top=document.documentElement.scrollTop||window.pageYOffset ||document.body.scrollTop;
document.getElementById("divA").style.top=(top+50)+"px";
}
function closeImg(){
document.getElementById("divA").style.display="none";
}
</script>
</head>
<body>
<div id="divA">
<img src="advpic.gif"/>
<img src="close.jpg" id="divImg" οnclick="closeImg();"/>
</div>
<div id="divCenter">
<img src="contentpic.jpg" />
</div>
</body>
</html>
网页中广告随着滚动条滚动位置不变
最新推荐文章于 2019-05-09 14:38:24 发布