[Javascript] Refresh an image, change an image

Troy III Ajnej trojani2000 at hotmail.com
Fri Jun 11 12:27:24 CDT 2004


Hey Tim,

>
><div id="live_image">
><img src="http://www.company.com/images/live_image.gif" width="741"
>height="631" alt="" name="itsalive">
></div>
>
>
Don't know why have you wrapped the image in a div tag but that's your 
choice.
A simple refresh can be done if you simply call the position or any other 
css property of that image.
a reload (fresh download) of the same image can be achieved in the same way 
as you swithch this image with the new one.
Use any event generator object, or create one with usual (onclick, 
onmouseover etc) than state:

'itsalive.src="http://www.company.com/images/live_image.gif"'

'itsalive.src="http://www.company.com/images/live_image2.gif"'

or if you for some reason(after resizing the window, the imeage does not 
fill its own place) you just need to refresh the image, than

[the event name] = 'itsalive.style.width="741"' will force the redraw with 
no repeated request to the server.


Regards Bekim.

>My reason for asking is that the page has quite a few other images, but 
>none
>of them need refreshing. Loading them all again would slow things down, and
>is really un-necessary.
>
>******************************************
>2nd question
>
>Assuming I want to change the above image on the page for a new one on my
>server, (not previously downloaded), such as
>http://www.company.com/images/live_image2.gif what would be the code for a
>form-button that would do that ?
>
>
>Note that pre-loading both images isn't an option as they are generated on
>the server.
>
>Tim in Ireland.
>
>
>_______________________________________________
>Javascript mailing list
>Javascript at LaTech.edu
>https://lists.LaTech.edu/mailman/listinfo/javascript

_________________________________________________________________
The new MSN 8: smart spam protection and 2 months FREE*  
http://join.msn.com/?page=features/junkmail




More information about the Javascript mailing list