对联广告代码
上面是效果图,已下是代码,直接copy就行
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>对联广告 - xionglibing.cn</title>
5 <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
6 </head>
7 <body style="margin:0px;">
8 <div align="center">
9 <table border="1" width="776" height="3000" cellspacing="0" cellpadding="0">
10 <tr>
11 <td width="100%" valign="top"><div align="center" style="color:green;font-size:23pt;font-family:黑体;"><br><br>页<br>面<br>区<br>域</div></td>
12 </tr>
13 </table>
14 </div>
15 <script language="javascript" type="text/javascript">
16 <!--
17 var showad = true; //是否显示广告
18 var Toppx = 60; //上端位置
19 var AdDivW = 100; //宽度
20 var AdDivH = 360; //高度
21 var PageWidth = 800; //页面多少宽度象素下正好不出现左右滚动条
22 var MinScreenW = 1024; //显示广告的最小屏幕宽度象素
23
24 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>'
25 var AdContentHtml = '<div align="center" style="color:green;font-size:23pt;font-family:黑体;"><br><br>广<br>告<br>内<br>容</div>';
26 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>');
27 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>');
28 function scall(){
29 if(!showad){return;}
30 if (window.screen.width<MinScreenW){
31 alert("临时提示:\n\n显示器分辨率宽度小于"+MinScreenW+",不显示广告");
32 showad = false;
33 document.getElementByIdx("Javascript.LeftDiv").style.display="none";
34 document.getElementByIdx("Javascript.RightDiv").style.display="none";
35 return;
36 }
37 var Borderpx = ((window.screen.width-PageWidth)/2-AdDivW)/2;
38
39 document.getElementByIdx("Javascript.LeftDiv").style.display="";
40 document.getElementByIdx("Javascript.LeftDiv").style.top=(document.documentElement.scrollTop+Toppx)+"px";
41 document.getElementByIdx("Javascript.LeftDiv").style.left=(document.documentElement.scrollLeft+Borderpx)+"px";
42 document.getElementByIdx("Javascript.RightDiv").style.display="";
43 document.getElementByIdx("Javascript.RightDiv").style.top=(document.documentElement.scrollTop+Toppx)+"px";
44 document.getElementByIdx("Javascript.RightDiv").style.left=(document.documentElement.scrollLeft+document.documentElement.clientWidth-document.getElementByIdx("Javascript.RightDiv").offsetWidth-Borderpx)+"px";
45 }
46
47 function hidead()
48 {
49 showad = false;
50 document.getElementByIdx("Javascript.LeftDiv").style.display="none";
51 document.getElementByIdx("Javascript.RightDiv").style.display="none";
52 }
53 window.onscroll=scall;
54 window.onresize=scall;
55 window.onload=scall;
56 //-->
57 </script>
58 </body>
59 </html>
60