Copy code code as follows:
<html>
<head>
<meta http-equiv = "content-type" content = "text/html; charset = gb2312">
<Title> Web floating advertising code with a closed button </Title>
</head>
<body>
<div ID = "img" style = "position: absolute; left: 311; TOP: 815; visibility: hidden; ERVAL = SetInterval ('Changepos (), Delay) "Align =" Right ">
<A href = "#" target = "_lank"> <img src = "picture path" online "online =" 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
Copy code code as follows:
var XPOS = 20;
var yPos = document.body.clitingheight;
var step = 1;
var delay = 30;
var height = 0;
var hoffset = 0;
var war 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.clitingheight;
HOFFSET = Img.Offsetheight;
Woffset = img.OffsetWidth;
img.style.left = xPOS + DCUMENT.BODY.ScrollLeft;
img.style.top = yPOS + DCUMENT.BODY.Scrolltop;
if (yon) {
yPOS = YPOS + STEP;
}
else {
yPOS = YPOS -STEP;
}
if (ypos <0) {
yon = 1;
YPOS = 0;
}
if (ypos> = (height -host) {{
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 ();