侧栏广告

来源:互联网 发布:windows10平板优化版 编辑:程序博客网 时间:2024/05/01 10:17

 

  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.     <title>无标题页</title>
  5.     <link href="css/flowad.css"  rel="Stylesheet" type="text/css"/>
  6.     <script src="js/jquery-1.2.6.js" type="text/javascript"></script>  
  7.     <script type="text/javascript">
  8.         $(this).scroll(function() { 
  9.             var bodyTop = 0;   
  10.             //pageYOffset,设置或返回当前页面相对于窗口显示区左上角的 Y 位置。
  11.             if (typeof window.pageYOffset != 'undefined') {   //typeof取得类型
  12.                 bodyTop = window.pageYOffset;   
  13.             }
  14.             else 
  15.             {   //compatMode,文档模式。
  16.                 if (typeof document.compatMode != 'undefined' && document.compatMode != 'BackCompat')
  17.                 {   
  18.                     bodyTop = document.documentElement.scrollTop;   
  19.                 }   
  20.                 else if (typeof document.body != 'undefined') {   
  21.                     bodyTop = document.body.scrollTop;   
  22.                 }   
  23.             }
  24.   
  25.             $("#qqonline").css("top", 100 + bodyTop);  
  26.     
  27.             $("#qqonline1").css("top", 100 + bodyTop);
  28.     
  29.         }); 
  30.     </script>
  31. </head>
  32. <body>
  33.     <div style="height:888px; width:700px; background-color:Silver; margin:0 auto;">Hello
  34.     </div>
  35.     <div id="qqonline">  
  36.         <img src="images/left.jpg" style=" width:95px;height:180px" />
  37.     </div>  
  38.      <div id="qqonline1">  
  39.        <img src="images/y3.gif" style=" width:95px;height:180px" />
  40.     </div>
  41. </body>
  42. </html>

css文件

  1.   #qqonline{
  2.             border:0
  3.             position:absolute;   
  4.             top:100px;   
  5.             padding:0px;
  6.             width:95px;   
  7.             height:180px;   
  8.         } 
  9.           
  10.         #qqonline1
  11.         {
  12.             margin-right:0px;
  13.             border0;  
  14.             position:absolute;   
  15.             top:100px;  
  16.             right:0px;   
  17.             width:95px;   
  18.             height:180px;   
  19.         }   
原创粉丝点击