tags:

views:

62

answers:

2

My main goal is to search an iframe for a specific image. I know what the image will be (abc_clicked.gif) but am not sure how I can access the iframe to either:

1) search the iframe for the image itself 2) grab the source code in which I will manually search myself for the image

I am looking trying to accomplish this with javascript, as I don't see how PHP could help me at all in this case.

Anyone have any ideas???? I'm lost....

+1  A: 

If the iFrame is hosted on the same domain, you can access the DOM the same as you would for the main page using contentDocument.

For example:

var iframeElement = document.getElementById('myiframe');
var imageElement = iframeElement.contentDocument.getElementById('myImage');
mopoke
`IFRAME` was not made by Apple. **Please** don't write iFrame.
SLaks
A: 

what if the iframe doesn't have a name, and you cav't give it a name because it's generated by a script?

Harry