javascript广告代码_两侧浮动

 1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 2 <html xmlns="http://www.w3.org/1999/xhtml">
 3 <head>
 4 <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
 5 <title>javascript广告代码_两侧浮动</title>
 6 <style type="text/css">
 7 body { height:10000px;}
 8 </style>
 9 </head>
10 
11 <body>
12 <script>
13 var ad_LR = {    //javascript广告代码_两侧浮动
14     speed : 200,    //速度
15     ad_left_gg : "<div ad_left_gg\" ><a href='#' onclick=\"document.getElementById('ad_left_gg').style.display='none'; return false;\">关闭</a></div>",    //左侧
16     ad_right_gg : "<div ad_right_gg\" ><a href='#' onclick=\"document.getElementById('ad_right_gg').style.display = 'none'; return false;\">关闭</a></div>",    //右侧
17     getScroll : function getScroll(){    //根据滚动条滚动
18         var posY
19         if (document.documentElement && document.documentElement.scrollTop) {
20             posY = document.documentElement.scrollTop;
21         } else if (document.body) {
22             posY = document.body.scrollTop;
23         }
24      
25         var top=window.screen.height>900 ? 5 : 5 ; //距离top的距离
26         document.getElementById('ad_left_gg').style.top=(posY+top)+'px';
27         document.getElementById('ad_right_gg').style.top=(posY+top)+'px';
28     }
29 }
30   
31 document.write (ad_LR.ad_left_gg, ad_LR.ad_right_gg);
32 setInterval(ad_LR.getScroll, ad_LR.speed);
33     
34 </script>
35 </body>
36 </html>