Solved

Dynamically updating the contents of a Table from another Frame.

Posted on 2007-04-07
3
220 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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

759 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now