06-07-2004, 02:28 AM
I would like to use an all-encompassing script for several elements of the page I am working on. In order to do this I need to put a variable in document.images. I've tried:
none of those seems to work...thanks in advance for any help!
06-07-2004, 04:24 AM
What exactly are you trying to do? If it's accessing the src attribute of an image, what you have there should suffice (1, 3, and 4 anyway; 2 won't work because thisimg doesn't have anything assigned to it) assuming the names are correct. A quick guess would be that this code isn't being executed via the window.onload event handler, hence, the image objects do not yet exist and you therefore cannot access them.
06-07-2004, 05:39 AM
not quite...what I'm doing is trying to use the same code for an image swap of three different images. Ex. Image 1 from a hamburger to a hot dog, image 2 from a car to a truck, and image 3 from a basketball to a baseball. I have buttons under each image that control the swap. What's not working is I need to establish a variable that can be manipulated for the document.images['this variable here'].src for the 3 images. In other words, I'm trying to use the same code to access the .src for three different images. If that doesn't make sense to anyone, I'll copy the code here so you can see exactly what I'm trying to do.
06-07-2004, 07:25 AM
Something like this (http://www.codingforums.com/showthread.php?t=39301)?
06-07-2004, 11:02 AM
Perfect!! I looked through the forums before and couldn't find it! Thanks, glengv!
06-07-2004, 11:23 AM
Sometimes, you just have to use the right keywords to get more results.