When asking for an image that is not available what is the value that gets stored in document.(image name) ? Is it null? Any thoughts.
Sincerely,
Brett
The Image object doesn't have a Value property. It has a SRC property which is what your most likely thinking of. It should contain an emtpy string (""), since Javascript is supposed to initialize objects at creation.
Actually, what I am refering to is that I have a script to go out and grab an image sorta like a photo album and it just keeps grabbing the next image etc if the user hits the forward button. However, it would be nice to know when the image is not there. Otherwise it shows the little X and gets really messed up. Here is the URL http://www.uwplatt.edu/~sigeps/photo.html
Are you trying to test if an image exists?
The following example should clarify things:
<script language='javascript'>
<!--
var pic1;
alert(document.images.pic1)
if (document.images.pic1 == null)
alert(1)
else alert(0)
//-->
</script>
If you place the above in a blank page the first alert will say "undefined". However the second will come up with "1", meaning that if you try to access an image that does not exist, the value returned will be null. This should also be true if you use the following syntax:
alert(document.images[num]) and alert(document.images['name']) since the return value of an out of bounds array element (regardless of type) is null
Vinny
Bookmarks