stanleykagan@yepmail.net (stan k.) wrote in message news:<eda56d76.0402031836.3c7737e0@posting.google. com>...[color=blue]
> -
> function DelayedWrite(){
> window.setTimeout('DelayedWrite()',3000);
> document.write("<img src="http://remoteurl/verybigimage1.jpg");
> window.setTimeout('DelayedWrite()',3000);
> document.write("<img src="http://remoteurl/verybigimage2.jpg");
> // etc . . .
> }
>
> onload = window.setTimeout('DelayedWrite()',3000);
> -
>
> What is occuring is that the initial time delay onload works but the
> delays
> within the function itself do not seem to do anything...
>[/color]
Hi
The function DelayedWrite() executes 3s after the web page loads.
[POINT X]
Once inside the function, all of the of the image tags are written
with no perceptable delay.
Each of several timeouts call the function 3s later [GO BACK TO POINT
X IN INFINITE LOOP].
It looks like an infinite loop with lots of image tags being written
every 3 seconds. Maybe this infinite loop clogs up your browser which
may look like a Denial of Service attack.
Assuming it doesn't work just putting all the images in with plain
HTML and the server really does think this is Denial of Service...
How about having an image of the words "Please Wait" called
pleaseWait.gif
In the body for each image you add
<img name="weather" src="pleaseWait.gif">,
how about using <body onload="delayLoad();"> to call the function:
function delayLoad() {
var len = document.weather.length;
// multiple objects named "weather" put in DOM as array with length
var imageURL="";
for (var i=0; i<len; i++) {
instr="document.weather["+i+"].src='http://remoteurl/verybigimage"+i+".jpg';";
window.setTimeout(instr,(i+1)*3000);
}
}
the function assembles strings (instructions) like:
document.weather[0].src='http://remoteurl/verybigimage0.jpg';
document.weather[1].src='http://remoteurl/verybigimage1.jpg';
document.weather[2].src='http://remoteurl/verybigimage2.jpg';
document.weather[3].src='http://remoteurl/verybigimage3.jpg';
etc
and sets up timeouts to execute the instructions one by one
3,6,9,12... seconds after the page loads.
I've not tested the above code, but I think it would replace the
"Please Wait" images in sequence with 3s delay between images.
Hope that's of some use.
Mark