对联广告在部分广告站中是必须的,大多采用JS的方式,因为可关闭,而纯CSS的js
下载:
对联广告.zip (其中需要广告图片路径,请注意修改)
如上图的代码:
<!doctype html> <html> <head> <meta charset="utf-8"> <title>对联广告</title> <script src="ad.js"></script> </head> <body> <style> /* a{position: fixed;top: 100px;}*/ </style> <script> function ad_left(){ var html; html = '<div id="ad_left" style="position:absolute; width:130px;height:300px;z-index:10001"><a style="position:absolute;top:-15px;left:0;" href="javascript:void(0);" onclick="document.getElementById(\'ad_left\').style.display=\'none\'">关闭</a><a href="http://www.jq-school.com"><img src="ad.jpg" width="130" height="300" /></a></div>'; dom.insertHtml(html);position.floatLeftCenter('ad_left'); } function ad_right(){ var html; html = '<div id="ad_right" style="position:absolute;width:130px;height:300px;z-index:10001"><a style="position:absolute;top:-15px;right:0;" href="javascript:void(0);" onclick="document.getElementById(\'ad_right\').style.display=\'none\'">关闭</a><a href="http://www.jq-school.com"><img src="ad.jpg" width="130" height="300" /></a></div>'; dom.insertHtml(html);position.floatRightCenter('ad_right'); } myEvent.add(window,'load',ad_left); myEvent.add(window,'load',ad_right); </script> </body> </html>