There are many ways to implement a floating picture with off functionality, here's how to use JavaScript, like the number of friends to understand the following
Code as follows: <html> <head> <meta http-equiv= "Content-type" content= "text/html; charset=gb2312 "> <title> Web page with close button floating AD code </title> </head> <body> <div id= "img" style= "Position:absolute; left:311; Top:815;visibility:hidden "onmouseover=" clearinterval (interval) "onmouseout=" interval = setinterval (' Changepos () ') , delay) "align=" right > <a href= "#" target= "_blank" ><img border= "0" src= "Picture path" onload= "return Imgzoom (this,600); "onclick=" Javascript:window.open (THIS.SRC); "style=" cursor:pointer; " /></a> <span style= "Cursor:hand;color:red;font-weight:bold" onclick= "ClearInterval" (interval); img.style.visibility = ' hidden ' ">X</span> </div> <script language=javascript src=ff.js > </script> </body> </html> ff.js code code is as follows: var xpos = 20; var yPos = document.body.clientheight; var step = 1; var delay = 30; var = 0; var hoffset = 0; var woffset = 0; var yon = 0; var Xon = 0; var pause = true; var interval; img.style.top = ypos; function Changepos () { width = document.body.clientwidth; height = document.body.clientheight; Hoffset = img.offsetheight; Woffset = img.offsetwidth; Img.style.left = xpos + document.body.scrollleft; img.style.top = YPos + document.b ody.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; x Pos = (Width-woffSet); } } function Start () { img.style.visibility = "visible"; interval = setinterval (' Chan Gepos () ', delay); } start ();