How to utilize var in frame a from frame b (IE does not play)

F

F. Da Costa

Hi all,

Here is the situation:
Frame set with two frames: jsLib & mainContent
*jsLib* contains variables that change and are dequired during the session
*mainContent* contains the pages the user looks at. From time to time they
contains js producing DOM elements and onload js as well.

The jsLib contains a function (see below) that modifies DOM elements that
are shown on the mainContent. In doing that it has to use a variable that
stays in place during the whole session.

I have got the above working totally ok in Gecko and guess what. Indeed, IE
5+ doesn't.
Using IE5+ I can initialize parent._staticTable but when I come back a
second time it still exists *but* rows does not contains any entries anymore.
Gecko just keeps the variable parent._staticTable inplace no worries but IE
seems to mess something up. I suppose the question is obvious.
How does one keep track of (in memory) values in IE?

TIA
Fermin DCG



var _tbodyRows; // filled by the mainContent page displaying a table

/**
* This function is responsible for inserting a new tBody in an extisting
table.
* @param table = the ID of the table where th tbody needs to be inserted
*/
function createTbody(win, tBodyID) {
var windoc = win.document;
var myDiv = windoc.getElementById("doc");

if (tBodyID=="" || !parent._staticTable) {
parent._staticTable = (!parent._staticTable) ? staticTable :
parent._staticTable;
(parent._staticTable.rows) ? alert("createTbody::Init
Rows:"+parent._staticTable.rows.length) : alert("Init No Rows");
return;
}
else {
var defaultTable = windoc.getElementById("treeTable");
(parent._staticTable.rows) ? alert("staticTable with
Rows:"+parent._staticTable.rows.length) : alert("No Rows in staticTable");
myDiv.replaceChild(parent._staticTable, defaultTable);
}
// creates an element whose tag name is TBODY
var mytablebody = windoc.getElementById(tBodyID);
// creating all cells within the rows
for(var j=0, rLen=_tbodyRows.length; j<rLen; j++) {
// creates an element whose tag name is TR
var mycurrent_row=windoc.createElement("TR");

// start working on the columns
for(var i=0, cLen=_tbodyRows[0].length; i < cLen; i++) {
// creates an element whose tag name is TD
var mycurrent_cell=windoc.createElement("TD");
// creates a Text Node
var currenttext=windoc.createTextNode(_tbodyRows[j]);
// appends the Text Node we created into the cell TD
mycurrent_cell.appendChild(currenttext);
// appends the cell TD into the row TR
mycurrent_row.appendChild(mycurrent_cell);
}
// appends the row TR into TBODY
mytablebody.appendChild(mycurrent_row);
}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,127
Latest member
CyberDefense
Top