473,387 Members | 1,492 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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

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.

window.testFrameset.pictureFrame
window.parent.pictureFrame
window.document.testFrameset.pictureFrame

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>
  26.  
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
4 2712
iam_clint
1,208 Expert 1GB
var frame = parent.dynamicframe.document; dynamicframe being the name of the frame
Apr 30 '07 #2
ArrK
2
Clint,

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?

Art
May 1 '07 #3
acoder
16,027 Expert Mod 8TB
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
acoder
16,027 Expert Mod 8TB
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

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

Similar topics

4
by: Ray Schaeffer | last post by:
Hi, I've written a very simple test HTML/JS program where the JS code in one frame writes to a different frame with "parent.frame1.document.write(...". This seems to work ok with IE-6, but with...
7
by: Scott | last post by:
I need help to modify the code below to pass url variables from a framset. The click to run this will be in the mainFrame. This script works well in a non-frame page. Grabs the current url...
13
by: Stumped and Confused | last post by:
Hello, I really, really, need some help here - I've spent hours trying to find a solution. In a nutshell, I'm trying to have a user input a value in form's textfield. The value should then be...
1
by: Stephen Gartman | last post by:
Hello, I'm working on a three frame page.... Frame 1: Textbox to type in URL. Frame 2: Webpage of URL. Frame 3: HTML of URL. Is there a way to get javascript to display the HTML code of...
7
by: TLM | last post by:
I am trying to build a web application that will contain links to files on a users local computer. I am assuming that the files will be in a known location and can display in a browser window. ...
7
by: Andrea | last post by:
Hi there - I'm hoping someone can help me; I've been struggling with this for a few days! :-) I have a webpage that is comprised of many forms containing questions. As the user answers one...
3
by: rajarya | last post by:
Hi, I m designing a HTML page(index.html),here i have 2 frames,by defult both frames have index1.html and index2.html as their source . in first frame(index.html) ,i have some redio buttons,and a...
8
by: susinthaa | last post by:
Hi, I am new to javascript. This is my problem description. Actually I have 3 pages. In the first page I have 2 frames. In the first page(first) from one of the frame(first), I have a link to...
2
by: Abneo | last post by:
Hi all, I am very new to Javascript and I am in some need of some help. I am creating a site that has a madlib. I got the madlib code but now I want the results of the madlib to display in...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.