JS는 웹 페이지의 왼쪽과 오른쪽에 광고 특수 효과를 만듭니다.
인용하다:
코드 사본은 다음과 같습니다.
<script src = "js/ad.js"type = "text/javaScript"> </script>
2. 페이지 호출
<! doctype html public "-// w3c // dtd xhtml 1.0 transitional // en" "http://www.w.w.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"><Html xmlns = "http://www.w3.org/1999/xhtml"lang = "zh-cn"> <head> <meta http-equiv = "content-type"content = "text/html; charset = utf-8"/> <tonite> js는 왼쪽 및 오른쪽 플로팅 웹에 대한 ad 효과를 만듭니다. pages_www.vevb.com </title> <tyle> Body {font-family : Arial, Helvetica, Sans-serif, "安体"; 글꼴 크기 : 12px; 높이 : 2000px; 색상 :#667382}*{패딩 : 0px; 마진 : 0px;} ul {margin : 0px; 패딩 : 0px;} li {list-style-type : none; margin : 0px; padding : 0px;}. fl {float : 왼쪽;}. float;}. cl {clear :}. zz {margin-top : 0px; 0px; margin-left : auto;}. tc {text-align : center;}. type = "text/javaScript"> </script> </body> </html>3. JS 중단 광고 코드 ad.js
var browser = {ie6 : function () {return ((wind myWidth = 0; if (typeof (wind if (document.body) {myHeight = document.body.clientHeight; myWidth = document.body.clientWidth} return { 'height': myHeight, 'width': myWidth}}, getScroll : var myHeight = 0; var myWidth = 0; if (typeof (wind if (document.body) {myHeight = document.body.scrolltop; myWidth = document.body.scrollleft} return { 'height': myHeight, 'width': myWidth}}, getDocWidth : function (d) {if (! d) var d = document; return math.max (math.max (d.body.scrollwidth, d.documentelement.scrollwidth), math.max (d.body.offsetwidth, d.documentelement.offsetwidth), math.max (d.body.client.clientwidth, d.documentelement.clientwidth), getdocheight : getdocheight : d) math.max (math.max (d.body.scrollheight, d.documentelement.scrollheight), math.max (d.body.offsetheight, d.documentelement.offsetheight), math.max (d.body.client.clientHeight, d.documentElement.clientHeight); var dom = function (id) {var type = typeof (id); if (type == 'object') return id; if (type == 'string') return document.getElementByid (id); return null}, inserthtml : function (html) {var prag = document.createdOcumentFragment (); var div = div i = 0, ii = div.childnodes.length; i <ii; i ++) {frag.appendchild (div.childnodes [i])} document.body.insertbefore (frag, document.body.firstchild)}}}}}}; ele = dom.id (요소); if (! ele) return; if (ele.adeventListener) ele.addeventListener (유형, 핸들러, 거짓); else (ele.attachevent) ele.attachevent ( "on"+type, handler); "+type] = handler}, 제거 (요소, handler) {var ele = dom.id (element); if (! ele) return; if (ele.removeeventListener) ele.removeEventListener (유형, 핸들러, 거짓); 그렇지 않으면 (ele.detachevent) ele.detachevent ( "on"+type, handler); ele ele [on "+type] = null}}; right positive = {var inter (var in {null}); id = dom.id (id); var IE6 = browser.ie6 (); var win = browser.getWindow (); var ele = { 'height': id.clientHeight, 'width': id.clientWidth}; if (ie6) {var scrollbar = browser.getScroll ()} {var scrollbar = { 'height': 0, 'width': 0}; id.style.position = '고정'} ele.top = parseint ((win.height-ele.height) /2+scrollbar.h 8); id.style.top = ele.top+'px'; id.style.right = '3px'}, floatrightcenter : function (id) {position.rightcenter (id); var fun = function () {position.rightcenter (id)}; if (browser.ie6 ()) {myevent.add (Wind ie6 = browser.ie6 (); var win = browser.getWindow (); var ele = { 'height': id.clientHeight, 'width': id.clientWidth}; if (ie6) {var scrollbar = browser.getScroll ()} else {var scrollbar = { 'height': 0, 'width': 0}; id.style.position = '고정'} ele.top = parseint ((win.height-ele.height)/2+scrollbar .height); id.style.top = ele.top+'px'; id.style.left = '3px'}, floatleftCenter : function (id) {position.leftCenter (id); var fun = function () {position.leftCenter (id)}; if (browser.ie6 ()) {myevent.add (Window, 'scroll', 'scroll', fun); myevent.add (Window, 'resize', fun)} else {myevent.add (창, 'resize', fun)} {var html () {var html; html = '<div id = "ad_left"style = "위치 : 절대; 너비 : 130px; 높이 : 300px; z-index : 10001"> <스타일 = "위치 : 절대; 상단 : -15px; 왼쪽 : 0;" href = "JavaScript : void (0);" onclick = "document.getElementById (/'ad_left/'). style.display =/'none/'"> close </a> <a href = "http://www.plchome.org"> <img src = "images/ad.jpg"/> </a div> '; dom.inserthtml (html); position.floatleftCenter ( 'ad_left');} function ad_right () {var html; html = '<div id = "ad_right"style = "위치 : 절대; 너비 : 130px; 높이 : 300px; z-index : 10001"> <a Style = "위치 : 절대; 상단 : -15px; 오른쪽 : 0;" href = "JavaScript : void (0);" onclick = "document.getElementById (/'ad_right/'). style.display =/'none/'"> close </a> <a href = "// www.vevb.com"> <img src = "images/ad.jpg"/> </a> </div> '; dom.inserthtml (html); position.floatrightcenter ( 'ad_right');} myevent.add (창, '로드', ad_left); myevent.add (창, '로드', ad_right);마치다.