<!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>
</head>
<body>
<div style="width:993;height:1799;text-align:center">
<img src="images/contentpic.jpg"/>
</div>
<div style="top:30px;left:50px;position:absolute;z-index:5; " id="div">
<img src="images/advpic.jpg" />
<img src="images/close.jpg" onclick="showclose()" style="margin:0px -15px;position:absolute"/>
</div>
</body>
<script type="text/javascript">
//获取当前ID
var divobj = document.getElementById("div");
//获取长宽
var objtop = parseInt(divobj.style.top);
var objleft = parseInt(divobj.style.left);
//鼠标滚动事件
function move(){
var imgtop = document.documentElement.scrollTop;
var imgleft = document.documentElement.scrollLeft;
divobj.style.top = parseInt(objtop+imgtop)+"px";
divobj.style.left = parseInt(objleft+imgleft)+"px";
}
onscroll = move;
//关闭广告
function showclose(){
document.getElementById("div").style.display="none";
}
</script>
</html>