Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title></title>
<style type="text/css">
/*<![CDATA[*/
BODY {
height:3000px;
}
/*]]>*/
</style></head>
<body>
<script type="text/javascript">
/*<![CDATA[*/
function zxcRandomImage(o){
var src=o.imageSRC,w=o.imageWidth,h=o.imageHeight,n=o.imageCount,mv=o.minInvisibleTime,ms=o.randomInterval
var o=this,i=document.createElement('IMG'),m=document.createElement('DIV'),a,z0=0;
o.ms=typeof(ms)=='number'&&ms>0?ms:2000;
o.mv=typeof(mv)=='number'&&mv>0&&mv<o.ms?mv:o.ms/4;
n=Math.max(typeof(n)=='number'&&n>0?n:1,1);
h=typeof(h)=='number'&&h>0?h:null;
w=typeof(w)=='number'&&w>0?w:null;
m.style.position=i.style.position='fixed';
m.style.right=m.style.bottom=m.style.width=m.style.height='0px';
document.body.appendChild(m);
i.style.zIndex='1001';
i.style.left=i.style.top='-3000px';
i.src=src;
w&&h?i.width=w:null;
w&&h?i.height=h:null;
o.m=m;
o.a=[];
for (;z0<n;z0++){
i=i.cloneNode(false);
document.body.appendChild(i);
a=[i];
a[1]=setTimeout(function(){ o.show(a); },Math.floor(Math.random()*o.ms));
}
}
zxcRandomImage.prototype={
show:function(a){
var o=this,ms=Math.floor(Math.random()*o.ms),mv=Math.floor(Math.random()*o.mv);
clearTimeout(a[2]);
a[0].style.left=Math.floor(Math.random()*(o.m.offsetLeft-a[0].width))+'px';
a[0].style.top=Math.floor(Math.random()*(o.m.offsetTop-a[0].height))+'px';
a[1]=setTimeout(function(){ o.show(a); },ms+mv);
a[2]=setTimeout(function(){ a[0].style.top='-3000px'; },ms-mv);
}
}
new zxcRandomImage({
imageSRC:"http://www.vicsjavascripts.org/StdImages/1.gif",
imageWidth:20,
imageHeight:18,
imageCount:5,
minInvisibleTime:500,
randomInterval:2000
})
/*]]>*/
</script>
</body>
</html>
Bookmarks