编程论坛 » JavaScript论坛 » 求浮动广告例子!
注册会员
帖子:61精华:0积分:752在线:21 小时注册:2007-11-6
搜索更多相关主题的帖子: 广告 例子
查看详细资料
TOP
高级会员
帖子:717精华:1积分:7628来自:重庆在线:154 小时注册:2008-6-12
查看个人网站
新手上路
帖子:7精华:0积分:170在线:0 小时注册:2008-7-1
中级会员
帖子:302精华:1积分:3751威望:2 在线:350 小时注册:2008-6-3
<!DOCTYPE html PUBLIC"-//w3c//dtd xhtml 1.0 strict//en" "http://www.w3.org/tr/xhtml1/dtd/strict.dtd"> <html xmlns="http://www.w3c.org/1999/xhtml"> <head><title></title> <style type="text/css"> *{padding:0px auto;margin:0px auto;} body{font-size:12px;font-family:宋体;padding:0px;} p{margin:500px auto;} </style> </head> <script language="javascript"> function soll(a,b){ this.objb=b; this.obja=document.getElementById(a); this.obja.style.fontSize="0px"; this.obja.style.width="100%"; this.obja.style.height="0px"; this.obja.style.position="absolute"; this.obja.style.top=b + "px"; this.obja.style.left="0px"; this.a=null; var objthis=this; window.onscroll=function(){ var aa=document.documentElement.scrollTop; clearTimeout(objthis.a) objthis.a=setTimeout(function(){objthis.obja.style.top=(document.documentElement.scrollTop + objthis.objb) + "px"},300); } } </script> <body> <p></p> <!--对联天始--> <div id="aa"> <div style="width:100px;margin:0px 10px;float:left;height:300px;border:1px solid red">对联</div> <div style="width:100px;margin:0px 10px;float:right;height:300px;border:1px solid red">对联</div> </div> <script language="javascript"> var fff=new soll("aa",10) </script> <!--结束--> </body></html>