Solved

Dynamically updating the contents of a Table from another Frame.

Posted on 2007-04-07
3
222 Views
Last Modified: 2010-04-16
I have a frameset containing two frames.
"Left" contains a series of images in a table (one image per cell).
"Right" contains one larger image in one cell of a table and associated text in another cell.
I am able to use "onClick" for each of the images in "Left" to update the source image (and Alt) of the first cell in "Right" (using "parent.right.document.MainPic") , but also need to update the text in the second cell.
I am having trouble finding out howI can reference the appropriate cell in the "Right" frame from "Left".
0
Comment
Question by:Waratah
3 Comments
 
LVL 15

Expert Comment

by:stanscott2
ID: 18870708
Let's assume that there's only one table in the right frame:

var tbl = parent.right.document.getElementsByTagName("table")[0];
tbl.rows(0).cells(1).innerText = "My new text";
0
 

Author Comment

by:Waratah
ID: 18872172
Previewing the frameset generates an error message relating to "tbl"  - Null or does not exist.
0
 
LVL 51

Accepted Solution

by:
ahoffmann earned 125 total points
ID: 18872723
you better use a named tag in your cells, for example in your second cell:

  <td><div id="mytext">text</div></td>

then you can access it like:

  parent.right.document.getElementById('mytext').innerHTML='new text';
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question