[Javascript] Refresh an image, change an image

Scott Hamm ScottHam at clientlogic.com
Fri Jun 11 12:58:03 CDT 2004


Wrapping the image in a div provides many possibilities when it comes around
to CSS design. When you only use img tag without division, it will only
reduce on how much you could do with CSS.

-----Original Message-----
From: javascript-bounces at LaTech.edu
[mailto:javascript-bounces at LaTech.edu]On Behalf Of Troy III Ajnej
Sent: Friday, June 11, 2004 1:27 PM
To: javascript at LaTech.edu
Subject: RE: [Javascript] Refresh an image, change an image


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

_______________________________________________
Javascript mailing list
Javascript at LaTech.edu
https://lists.LaTech.edu/mailman/listinfo/javascript



More information about the Javascript mailing list