我有 但是是左右2边的 你直接复制 然后放在JS文件里 lastScrollY = 0function heartBeat(){ var diffYif (document.documentElement &&document.documentElement.scrollTop) diffY = document.documentElement.scrollTopelse if (document.body) diffY = document.body.scrollTop else {/*Netscape stuff*/} //alert(diffY)percent=.1*(diffY-lastScrollY)if(percent>0)percent=Math.ceil(percent)else percent=Math.floor(percent)document.getElementById("leftDiv").style.top = parseInt(document.getElementById("leftDiv").style.top)+percent+"px"document.getElementById("rightDiv").style.top = parseInt(document.getElementById("rightDiv").style.top)+percent+"px"lastScrollY=lastScrollY+percent//alert(lastScrollY)} //下面这段删除后,对联将不跟随屏幕而移动。 window.setInterval("heartBeat()",1)//-->//关闭按钮 function close_left1(){ // left1.style.visibility='hidden'left1.style.display='none'leftDiv.style.display='none'} function close_right1(){ //right1.style.visibility='hidden'right1.style.display='none'rightDiv.style.display='none'} //显示样式 document.writeln("<style type=\"text\/css\">")document.writeln("#leftDiv,#rightDiv{width:100pxheight:100pxbackground-color:#fffposition:absolute}")document.writeln(".itemFloat{width:100pxheight:autoline-height:5px}")document.writeln("<\/style>")//以下为主要内容 document.writeln("<div id=\"leftDiv\" style=\"top:40pxleft:5px\">")//------左侧各块开始 //---L1 document.writeln("<div id=\"left1\" class=\"itemFloat\">")document.writeln("<a href='freecalls_business.aspx'><img src=images\\index_ad_3_min.jpg width=100 height=300 /></a>")document.writeln("<br><a href=\"javascript:close_left1()\" title=\"关闭广告\">×<\/a><br><br><br><br>")document.writeln("<\/div>")//------左侧各块结束 document.writeln("<\/div>")document.writeln("<div id=\"rightDiv\" style=\"top:40pxright:5px\">")//------右侧各块结束 //---R1 document.writeln("<div id=\"right1\" class=\"itemFloat\">")document.writeln("<a href='huodong_kaixue.html'><img src=images\\index_ad_4_min.jpg width=100 height=300 /></a>")document.writeln("<br><a href=\"javascript:close_right1()\" title=\"关闭广告\">×<\/a><br><br><br><br>")document.writeln("<\/div>")//------右侧各块结束 document.writeln("<\/div>")
记得采纳啊
<html>
<head>
<title>漂浮的图片</title>
<meta http-equiv="Content-Type" content="text/htmlcharset=gb2312">
<!--head头部代码开始-->
<script language="JavaScript" SRC="moveobj.js"></script>
<script>
var chip1
var chip2
var chip3
//根据使用的图片的多少增加或减少上面相应代码;
function pagestart()
{checkbrOK()
chip1=new Chip("chip1",160,80)
chip2=new Chip("chip2",60,80)
//根据使用的图片的多少增加或减少上面的相应代码
if(brOK)
{ movechip("chip1")
movechip("chip2")
//根据使用的图片的多少增加或减少上面的相应代码
}
}
</script>
<!--代码结束-->
<link rel="stylesheet" href="../style.css">
<body onLoad="pagestart()" onUnload="if(brOK) {stopme('chip1')stopme('chip2')}" bgcolor="#FFFFFF" text="#000000" >
<DIV ID="chip1" STYLE="position:absolutewidth:47height:68">
<A HREF="rm/ad1.htm"><IMG SRC="ballon1.jpg" BORDER=0></a>
</DIV>
<DIV ID="chip2" STYLE="position:absolutewidth:47height:68">
<A HREF="rm/ad2.htm"><IMG SRC="ballon2.jpg" BORDER=0></a>
</DIV>
<center>
<p>
<script src="moveobj.js"></script>
</center>
</body>
</html>
function closead(){
document.getElementById("left").style.display="none"
document.getElementById("right").style.display="none"
}
<div id="left">
<p></p>
<a href="javascript:closead()" title="关闭广告">×关闭</a>
</div>