Yes! This works.
Thank you for your help.
Arman
User Profile
Collapse
-
Let me explain what I'm trying to do:
There is a document ("doc1") that contains an image ("img1") and an IFRAME ("iframe1") . In this IFRAME, a second document is loaded ("doc2").
In doc2, I want to change the source of img1 in doc1.
When doing this in doc1, the code will be:
Code:function changeSrc() { document.getElementById("img1").src="any_image.gif"
Leave a comment:
-
Sorry, it's doesn't work.
I need in the IFRAME document the image in the parent. Thus, this refers to an image in the frame (at least, that's what I understand):Code:window.frames['your_frame_name'].document.getElementById('img_id').src
Code:window.parent.document.getElementById('img_id').src
Thanks, ArmanLeave a comment:
-
JavaScript: How to access an image in main doc from iframe
Please help on the following:
I have a document loaded in an IFRAME. In that document, I need in a JavaScript to access an image (having an ID) in the main document (the document including the IFRAME). What I want to do is to change the image source in the main document.
My question: what is the (DOM) code to access that image. Is the .referrer used here?
Thanks in advance, Arman
No activity results to display
Show More
Leave a comment: