The first kind of floating ad doesn't fit the consortium.
JavaScript floating ad code, very good, the code is concise, but once only drift one, replication can be used. Hope webmaster friends like.
<textarea id="runcode22253"><ptml> <pead> <title> floating advertising </title> <body> <div id= "Codefans_net" > <!--Links Address--> <!--picture address--> </div> <script> var x = 50,y = var Xin = true, Yin = true var step = 1 var delay = ten var Obj=document.getelementbyid ("codefans_net") function float () {var l=t=0 var r= document.body.clien twidth-obj.offsetwidth var B = document.body.clientheight-obj.offsetheight Obj.style.left = x + document.body.scrollLef T obj.style.top = y + document.body.scrollTop x = x + step* (xin?1:-1) if (x < L) {Xin = true; x = L} if (x > R) {xin = false; x = R} y = y + step* (yin?1:-1) if (Y < T) {Yin = true; y = T} if (Y > B) {yin = false; y = b} var itl= setinterval ("float ()", delay) obj.onmouseover=function () {clearinterval (ITL)} obj.onmouseout=function () { Itl=setinterval ("float ()", delay)} </script> </body> </ptml></textarea>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]
The second type of floating ad doesn't meet the standard.
JS floating Advertising code, compared to the classic floating ads, is still very practical, if you are a webmaster, this code is a must, hope for you useful.
<ptml> <pead> <meta http-equiv= "Content-type" content= "text/html; charset=gb2312 "/> <title> floating advertising </title> </pead> <body> <div id=img1 style=" Z-INDEX:100; left:2px; width:59px; Position:absolute; top:43px; height:61px; visibility:visible; " ></DIV> <SCRIPT> var xpos = 300; var yPos = 200; var step = 1; var delay = 30; var height = 0; var hoffset = 0; var woffset = 0; var yon = 0; var xon = 0; var pause = true; var interval; Img1.style.top = YPos; function Changepos () {width = document.body.clientWidth; Height = document.body.clientHeight; Hoffset = Img1.offsetheight; Woffset = Img1.offsetwidth; Img1.style.left = xpos + document.body.scrollLeft; Img1.style.top = YPos + document.body.scrollTop; if (yon) {YPos = YPos + step;} else {yPos = Ypos-step;} if (YPos < 0) {yon = 1;ypos = 0;} if (YPos >= (Height-hoffset)) {yon = 0;ypos = (height-hoffset);} if (xon) {xpos = xpos + steP;} else {xpos = Xpos-step;} if (Xpos < 0) {Xon = 1;xpos = 0;} if (xpos >= (Width-woffset)) {Xon = 0;xpos = (width-woffset);} function Start () {img1.visibility = "visible"; Interval = setinterval (' Changepos () ', delay); The function Pause_resume () {if (pause) {clearinterval (interval); Pause = false;} else {interval = setinterval (' Changepos () ', delay); Pause = true; } start (); </SCRIPT> </body> </ptml>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]
The above two are not supported by the standard Declaration
the third type of floating advertising code conforming to the consortium
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd "> <ptml> <pead> <meta http-equiv=" Content-type "content=" text/html; charset=gb2312 "/> <title> floating Advertising code for the consortium-cloud Habitat </title> </pead> <body> <script> documen T.write ("<div id=img1") document.write ("visibility:visible;" > ") document.write (" ") document.write (" ") document.write (" </DIV> ") var xpos = 300; var yPos = 200; var step = 1; var delay = 8; var height = 0; var hoffset = 0; var woffset = 0; var yon = 0; var xon = 0; var pause = true; var interval; Img1.style.top = YPos; function Changepos () {width = document.documentElement.clientWidth; Height = document.documentElement.clientHeight; Hoffset = Img1.offsetheight; Woffset = Img1.offsetwidth; Img1.style.left = xpos + document.documentElement.scrollLeft; Img1.style.top = YPos + document.documentElement.scrollTop; if (yon) {YPos = YPos + step;} else {yPos = Ypos-step;} if (YPos < 0) {yon = 1;ypos = 0;} if (YPos >= (Height-hoffset)) {yon = 0;ypos = (height-hoffset);} if (xon) {xpos = xpos + step;} else {xpos = Xpos-step;} if (Xpos < 0) {Xon = 1;xpos = 0;} if (xpos >= (Width-woffset)) {Xon = 0;xpos = (width-woffset);} function Start () {img1.visibility = "visible"; Interval = setinterval (' Changepos () ', delay); The function Pause_resume () {if (pause) {clearinterval (interval); Pause = false;} else {interval = setinterval (' Changepos () ', delay); Pause = true; } start (); </script> </body> </ptml>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]