[thelist] image refresh not page refresh

Joshua Olson joshua at waetech.com
Thu Jan 15 03:27:08 CST 2004


----- Original Message ----- 
From: "John C Bullas (soton.ac.uk relay)" <jcbullas at nildram.co.uk>
Sent: Thursday, January 15, 2004 4:18 AM


> Will this in the HTML (all in the body) to replace the image tag work? not
> sure if the path is supposed to be a URL or an absolute "CGI style"
> local reference?
>
> <script type="text/javascript" language="JavaScript">
> function reloadImage()
> {
>    img = document.getElementById('theimage');
>    img.src = '\mail.soton.ac.uk\home\johnb\public_html\webcam\Pryme.jpg?'
+
> Math.random();
> }
> </script>

If you are going to use the domain name, you'll need to put in the http://,
example:

img.src = 'http://mail.soton.ac.uk/home/johnb/public_html/webcam/Pryme.jpg?'

If the image is on the same domain, then you can do simply:

img.src = '/home/johnb/public_html/webcam/Pryme.jpg?'

JavaScript doesn't care if you use the full URL's or relative or root
relative URL's.

Also, URL's use forward slashes (/), never backward slashes (\)... very
important fact.

The code should work... give it a go and see how it work.  Make sure that
your image has an id that match the id in this line:

img = document.getElementById('theimage');

Since that line is referencing an image with the id "theimage", make sure
the image has the id attribute set.  If it's something else, change the
above line to match.

<><><><><><><><><><>
Joshua Olson
Web Application Engineer
WAE Tech Inc.
http://www.waetech.com/service_areas/GA/
706.210.0168



More information about the thelist mailing list