技术文章
当前位置:首页 > 技术文章

js左右浮动广告代码,js标准对联广告代码

<!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=gb2312" />
<title>js左右浮动广告代码,js标准对联广告代码 </title>
<style type="text/css">
<!--
#floatAdv1,#floatAdv2{
width:90px;
height:230px;
background-color:#ededed;
border:1px solid #ddd;
}
html,body{
height:1000px;
}
#floatdoby{
height:1000px;
}
-->
</style>
<script language="JavaScript" type="text/javascript">
lastScrollY=0;
function floatstart(){
var diffY;
if (document.documentElement && document.documentElement.scrollTop)
diffY = document.documentElement.scrollTop;
else if (document.body)
diffY = document.body.scrollTop
else
{/*Netscape stuff*/}
percent=.1*(diffY-lastScrollY);
if(percent>0)percent=Math.ceil(percent);
else percent=Math.floor(percent);
document.getElementById("floatAdv1").style.top=parseInt(document.getElementById
("floatAdv1").style.top)+percent+"px";
document.getElementById("floatAdv2").style.top=parseInt(document.getElementById
("floatAdv1").style.top)+percent+"px";
lastScrollY=lastScrollY+percent;
}
floatcode1="<DIV id=\"floatAdv1\" style=''left:2px;POSITION:absolute;TOP:120px;''>floatImage1</div>"
floatcode2="<DIV id=\"floatAdv2\" style=''right:2px;POSITION:absolute;TOP:120px;''>floatImage2</div>"
document.write(floatcode1);
document.write(floatcode2);
window.setInterval("floatstart()",1);
</script>
</head>
<body>
<div id="floatdoby"></div>
</body>
</html>