1/1, 1??1??

从往上摘录的源出处不详细。讲脚本放在head标记间。

  1. <script language="javascript" type="text/javascript"> 
  2. <!--  
  3. var showad = true;        //是否显示广告  
  4. var Toppx = 60;            //上端位置  
  5. var AdDivW = 100;        //宽度  
  6. var AdDivH = 360;        //高度  
  7. var PageWidth = 800;    //页面多少宽度象素下正好不出现左右滚动条  
  8. var MinScreenW = 1024;    //显示广告的最小屏幕宽度象素  
  9. var ClosebuttonHtml = '<div align="right" style="position: absolute;top:0px;right:0px;margin:2px;padding:2px;z-index:2000;"><a href="javascript:;" onclick="hidead()" style="color:red;text-decoration:none;font-size:12px;">关闭</a></div>' 
  10. var AdContentHtml = '<div align="center" style="color:green;font-size:23pt;font-family:黑体;">这里放广告,图片文字表格FLASH均可</div>';  
  11. document.write ('<div id="Javascript.LeftDiv" style="position: absolute;border: 1px solid #336699;background-color:#EEEEE2;z-index:1000;width:'+AdDivW+'px;height:'+AdDivH+'px;top:-1000px;word-break:break-all;display:none;">'+ClosebuttonHtml+'<div>'+AdContentHtml+'</div></div>');  
  12. document.write ('<div id="Javascript.RightDiv" style="position: absolute;border: 1px solid #336699;background-color:#EEEEE2;z-index:1000;width:'+AdDivW+'px;height:'+AdDivH+'px;top:-1000px;word-break:break-all;display:none;">'+ClosebuttonHtml+'<div>'+AdContentHtml+'</div></div>');  
  13. function scall(){  
  14.     if(!showad){return;}  
  15.     if (window.screen.width<MinScreenW){  
  16.         //alert("临时提示:nn显示器分辨率宽度小于"+MinScreenW+",不显示广告");  
  17.         showad = false;  
  18.         document.getElementById("Javascript.LeftDiv").style.display="none";  
  19.         document.getElementById("Javascript.RightDiv").style.display="none";  
  20.         return;  
  21.     }  
  22.     var Borderpx = ((window.screen.width-PageWidth)/2-AdDivW)/2;  
  23.     document.getElementById("Javascript.LeftDiv").style.display="";  
  24.     document.getElementById("Javascript.LeftDiv").style.top=(document.documentElement.scrollTop+Toppx)+"px";  
  25.     document.getElementById("Javascript.LeftDiv").style.left=(document.documentElement.scrollLeft+Borderpx)+"px";  
  26.     document.getElementById("Javascript.RightDiv").style.display="";  
  27.     document.getElementById("Javascript.RightDiv").style.top=(document.documentElement.scrollTop+Toppx)+"px";  
  28.     document.getElementById("Javascript.RightDiv").style.left=(document.documentElement.scrollLeft+document.documentElement.clientWidth-document.getElementById("Javascript.RightDiv").offsetWidth-Borderpx)+"px";  
  29. }  
  30. function hidead()  
  31. {  
  32.     showad = false;  
  33.     document.getElementById("Javascript.LeftDiv").style.display="none";  
  34.     document.getElementById("Javascript.RightDiv").style.display="none";  
  35. }  
  36. window.onscroll=scall;  
  37. window.onresize=scall;  
  38. window.onload=scall;  
  39. //--> 
  40. </script> 

 

所属分类: 点点滴滴学技术 | 发表评论(0) | 浏览: 838 | 作者: 帅豆
1/1, 1??1??
******公司