Forum Moderators: open

Message Too Old, No Replies

Using a delay

         

Me_Titus

5:37 pm on Feb 19, 2005 (gmt 0)

10+ Year Member



I have 2 pictures to load.
I also have a delay between them, everything goes ok, the only problem is that the two pictues are shown only after the delay is finished.

<picture1>
delay()
<picture2>

How can i write to the browser, when the firts image is loaded. The same function in javasript on the server side is flush(), but i am using client side scripting. Can anywone help on this please.

Thanks

adni18

7:07 pm on Feb 19, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



So.. you want to load the first picture, print it, then wait a second or two, load the second one, then print it?

orion_rus

7:53 pm on Feb 19, 2005 (gmt 0)

10+ Year Member



instead of delay u can make
setTimeout('document.write("<picture1>",10000);
10000 - is a time in miliseconds = 10 seconds
or u can make
setTimeout('picture2name.style.visibility="visible"',10000)
if 2 picture is hidden and u can show it after some time
Good luck to you

Me_Titus

12:52 am on Feb 20, 2005 (gmt 0)

10+ Year Member



That's it adni18,

i show one picture, make a two seconds delay, and then show the other one.

Thanks

Me_Titus

12:54 am on Feb 20, 2005 (gmt 0)

10+ Year Member



The thing orion_rus is that i am writing the picture using document.write, thus i can't set it to hidden.

Thanks anyway
;)

Bernard Marx

3:26 am on Feb 20, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



How about not using document.write, but going via the DOM instead?

incrediBILL

4:56 am on Feb 20, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



OK, this might sound too complex, but it's not.

Initially just put up a single BLANK pixel sized to the second image.

<image1>
<blank>

Set a 2 second timer on the document that then replaces the blank image with the actual image, like a mouseover works. You can preload the image which the document loads so it's ready when you are.

Me_Titus

2:10 pm on Feb 20, 2005 (gmt 0)

10+ Year Member



Thank you all, i solve the problem by using the setTimeout function.