By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,218 Members | 1,255 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,218 IT Pros & Developers. It's quick & easy.

How do I write to and display HTML code in another a frame with Javascript?

P: 2
I want to use a control frame to create and/or modify the content
(images and text) of a display frame - all files and images are client
side. [Does that make this a "widgit"?]. When I try to write to the
display frame from the control frame I get the error message:
"window.parent.pictureFrame has no properties" and all content of the
display frame disappears. My plan was to populate the DOM image object
for the display frame with the URIs for the graphics (a variable
number). Apparently I don't understand the DOM naming convention as
nothing I have tried (in desparation), works. Even
document.getElementById didn't work.


How do I access the pictureFrame to write and display HTML code to it?

How do I access the pictureFrame image object to set the anchor URIs?

How would this change if I were to write the frame from the main (frameset) page?

Expand|Select|Wrap|Line Numbers
  1. -------- Frameset page extract -------------
  2. <frameset rows="100,*" frameborder="0" border="0" name="testFrameset">
  3. <frame src="TestControl.htm" name="controlFrame">
  4. <frame src="TestPictures.htm" name="pictureFrame">
  5. </frameset>
  6. -------- TestControl page extract -------------
  7. <BODY name="controlBody">
  8. <h3>Control Frame</h3>
  9. <script language="JavaScript">             // None of these work
  10.                                            // Each tried separately
  11. alert(document.getElementById("pic01"))    // Displays "Null"
  12. var imagename0 = document.testFrameset.pictureFrame.image[0].src
  13.                 // error msg = document.testFrameset has no properties
  14. document.write(imagename0 + "<br>")
  15. window.parent.pictureFrame.image[0].src = db01.gif
  16.                 //error msg =  window.parent.pictureFrame has no properties
  17. </script>
  18. </BODY>
  19. -------- TestPictures page extract -------------
  20. <BODY name="picframeBody">
  21. <h3>Picture Frame</h3>
  22. <img src="ga01.gif" ID="pic01"</A>
  23. <img src="ga02.gif" ID="pic02"</A>
  24. <img src="ga03.gif" ID="pic03"</A>
  25. </BODY>
Thanks for any help you can offer.

Namaste', Art

If at first you DO succeed, try not to look astonished!

PS - I misspelled my login name. How do I change it or unsubscribe & re-signup?
Apr 29 '07 #1
Share this Question
Share on Google+
4 Replies

Expert 100+
P: 1,208
var frame = parent.dynamicframe.document; dynamicframe being the name of the frame
Apr 30 '07 #2

P: 2

Thank you for trying but that does not work.
I get the same results as before: "parent.pictureFrame has no properties"
(using the frame name in my sample code above).

Could you be more specific in your reply and include the property syntax in the reference? For example, what exactly would be the fully qualified name of the DOM images object in the "pictureFrame" frame from the "controlFrame" frame or from the parent?

In a "framed" page is there a DOM image objest for each frame or only one for the entire document?

May 1 '07 #3

Expert Mod 15k+
P: 16,027
Read this page and this ref..

Your problem might actually be that you are trying to access the "images" collection/array with "image[0]" instead of "images[0]".
May 1 '07 #4

Expert Mod 15k+
P: 16,027
PS - I misspelled my login name. How do I change it or unsubscribe & re-signup?
Since you (currently) only have two posts, you could just start again by signing up again with your new user name.
May 1 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.