Hi,
Can you help me?? Why code 1 eats up 100% of processor time when browser
window is active and code 2 doesn't????
Do I use setTimeout wrong somehow???
Code 1 changes visibility of div layer and code 2 changes pictures.
Does that make difference??
Regs.
-jori luoto
<!-- THIS IS CODE 1 -->
var clc=1;
var cl=null;
var timeo=null;
var lt=new Array(3);
function LayTime(){
if(lt.length==0 && clc==0) return true;
var nl=null;
if(cl==null) nl=0;
else if(cl<clc-1) nl=cl+1;
else if(cl==clc-1) nl=0;
var d=null,nd=null,scl="d"+cl+"t",ncl="d"+nl+"t";
if(cl!=null) d=document.getElementById(scl);
nd=document.getElementById(ncl);
if(d!=null) d.style.visibility='hidden';
nd.style.visibility='visible';
cl = nl;
timeo = setTimeout("LayTime()",lt[cl]*1000);
}
function ExitPage(){
if(timeo!=null) clearTimeout(timeo);
timeo = null;
}
</script>
<link href="../sys/info.css" rel="stylesheet" type="text/css">
</head>
<body bgcolor="#000000" leftmargin="0" topmargin="0" marginwidth="0"
marginheight="0" onLoad="LayTime()" onUnLoad="ExitPage()">
<div id="c0l">
....
</div></body></html>
<!-- THIS IS CODE 2 -->
function cycleAds() {
if (document.images) {
if (document.adBanner.complete) {
if (++thisAd == adImages.length) {thisAd = 0;}
document.adBanner.src = adImages[thisAd];
}
}
// change to next sponsor every 3 seconds
setTimeout("cycleAds()", 3000);
}