Welcome to Delicate template
Header
Just another WordPress site
Header

满屏幕飞的漂浮js广告

7月 12th, 2012 | Posted by 无 名 in js

该 js从网上收集。
去掉标准规范和不去掉是不同的样式,去掉之后支持火狐,ie。

<div id="dd" style="position:absolute; left:809px; top:128px; width:120px; height:120px; z-index:1" onMouseOver="pause_resume()" onMouseOut="pause_resume()">
  <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="120" height="120">
    <param name="movie" value="swf/pf.swf" />
    <param name="quality" value="high" />
    <param name="wmode" value="transparent">
    <embed src="swf/pf.swf" quality="high" wmode="transparent" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="120" height="120"></embed>
  </object>
</div>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
var xPos = 20;
var yPos = document.body.clientHeight;
var step = 1;
var delay = 10; 
var height = 0;
var Hoffset = 0;
var Woffset = 0;
var yon = 0;
var xon = 0;
var pause = true;
var interval;
document.getElementById('dd').style.top = yPos;
function changePos() {
width = document.body.clientWidth;
height = document.body.clientHeight;
Hoffset = dd.offsetHeight;
Woffset = dd.offsetWidth;
dd.style.left = xPos + document.body.scrollLeft;
dd.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() {
dd.visibility = "visible";
interval = setInterval('changePos()', delay);
}
function pause_resume() {
if(pause) {
clearInterval(interval);
pause = false;
}
else {
interval = setInterval('changePos()',delay);
pause = true;
   }
}
function closediv() {
document.getElementById('dd').style.display='none';
}
start();
//  End -->
</script>

You can follow any responses to this entry through the RSS 2.0 Both comments and pings are currently closed.