本文共 1274 字,大约阅读时间需要 4 分钟。
html
head
-="-Type"=";=GBK"/
简洁对联广告代码
="JavaScript"type="text/javascript"
lastScrollY=0;
functionheartBeat(){
vardiffY;
if(document.documentElement&&document.documentElement.scrollTop)
diffY=document.documentElement.scrollTop;
elseif(document.body)
diffY=document.body.scrollTop
else
{/*Netscapestuff*/}
//alert(diffY);
percent=.1*(diffY-lastScrollY);
if(percent0)percent=Math.ceil(percent);
elsepercent=Math.floor(percent);
document.getElementById("lovexin12").style.top=parseInt(document.getElementById
("lovexin12").style.top)+percent+"px";
document.getElementById("lovexin14").style.top=parseInt(document.getElementById
("lovexin12").style.top)+percent+"px";
lastScrollY=lastScrollY+percent;
//alert(lastScrollY);
}
suspendcode12="DIVid=\"lovexin12\"style='left:2px;POSITION:absolute;TOP:120px;'ad1/div"
suspendcode14="DIVid=\"lovexin14\"style='right:2px;POSITION:absolute;TOP:120px;'ad2/div"
document.write(suspendcode12);
document.write(suspendcode14);
window.setInterval("heartBeat()",1);
/script
styletype="text/css"
!--
#lovexin12,#lovexin14{
width:100px;
height:230px;
background-color:yellow;
border:2pxsolidred;
}
html,body{
height:800px;
}
#mm{
height:800px;
}
--
/style
/head
body
divid="mm"
基于JS+CSS+DIV的网页对联广告代码
/div
/body
/html
希望本文所述对大家的JavaScript程序设计有所帮助。
转载地址:http://heudv.baihongyu.com/