Copy code code as follows:
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 ">
<title> floating Advertising code with close buttons </title>
<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" ></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>
Ff.js Code
Copy Code code as follows:
var xpos = 20;
var yPos = document.body.clientHeight;
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;
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.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 () {
img.style.visibility = "visible";
Interval = setinterval (' Changepos () ', delay);
}
Start ();