should not be needed but sett red comments
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>
</head>
<body>
<img id="loading" src="http://www.vicsjavascripts.org/StdImages/loading.gif" />
<script type="text/javascript">
/*<![CDATA[*/
var ary=['http://www.vicsjavascripts.org/StdImages/0.gif','http://www.vicsjavascripts.org/StdImages/1.gif','http://www.vicsjavascripts.org/StdImages/2.gif','http://www.vicsjavascripts.org/StdImages/3.gif'];
for (var src,z0=0;z0<ary.length;z0++){
src=ary[z0];
ary[z0]=new Image();
ary[z0].src=src;
}
function Change(a,ld){
ld=document.getElementById(ld);
ld?ld.style.visibility='visible':null;
ChangeBG(a[Math.floor(Math.random()*a.length)],ld); // Math.floor(Math.random()*a.length)
}
function ChangeBG(i,ld){
clearTimeout(ChangeBG.to);
if (i.width<40){ // (40) change this value suitable to your image
return ChangeBG.to=setTimeout(function(){ ChangeBG(i,ld); },200);
}
document.body.style.backgroundImage='url('+i.src+')';
document.body.style.backgroundRepeat="no-repeat";
ld?ChangeBG.to=setTimeout(function(){ ld.style.visibility='hidden'; },5000):null; // (5000) change this value suitable to your image
}
Change(ary,'loading');
/*]]>*/
</script>
</body>
</html>
Bookmarks