SitePoint Sponsor |
|
User Tag List
Results 1 to 4 of 4
Thread: Image Object Value
-
Oct 12, 2000, 07:59 #1
- Join Date
- Sep 2000
- Location
- Chicago
- Posts
- 526
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Greetings,
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
-
Oct 12, 2000, 09:59 #2
- Join Date
- Aug 1999
- Location
- Lancaster, Ca. USA
- Posts
- 12,305
- Mentioned
- 1 Post(s)
- Tagged
- 0 Thread(s)
Originally posted by goughb
Greetings,
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
-
Oct 12, 2000, 11:26 #3
- Join Date
- Sep 2000
- Location
- Chicago
- Posts
- 526
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
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
Sincerely,
Brett
-
Oct 12, 2000, 11:36 #4
- Join Date
- Feb 2000
- Location
- where the World once stood
- Posts
- 700
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Hi Brett,
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
VinnyWhere the World Once Stood
the blades of grass
cut me still
Bookmarks