scriptkeeper
06-15-2003, 04:06 PM
Hello there agian! document.images[i] returns an array of all the images in the document right! Well this this leads to my questions! Does it return all the images in the document including thoughs in frames! Because I cant figure out how to reference frame then ask for images array!!
Skyzyx
06-15-2003, 06:41 PM
parent.document.frames["frameName"].document.images;
document.images.length will return the number of images in the document.
This does not include images in other documents loaded into another frame
In order to target another frame you use
parent.main.document.images.length
where main is the name of the frame
So to reference the second image in another frame so would go
parent.main.document.images[1]
scriptkeeper
06-16-2003, 12:31 AM
for some reason that doesn't work it returns a value of 0 but there are 24 images in that frame? And when I call specific image in the array it returns undefined? Could it be because I am using an iframe or am I just scripting challenged!
glenngv
06-16-2003, 01:44 AM
try referencing the frame from the top. I usually do it this way.
top.frames['nameOfTargetFrame'].document.images[i]
shlagish
06-16-2003, 05:31 AM
Maybe that frame uses frames....
Here are three senarios
In the page
document.images.length
In the page containing an Iframe
setTimeout("alert(document.IframeName.document.images.length)",4000)
From another frame in a frameset where a frame contains an Iframe
setTimeout("alert(parent.FrameName.document.IframeName.document.images.length)",4000)
The timeouts are to allow the page containing the images to load