I have a simple frame-based application where title information
appears in a top frame and a lower frame contains the content
for the application. One of the needs for this app is for a
status line in the upper frame to be updated when certain
actions are taken in the lower frame.
In the top frame, I have a line of text wrapped with SPAN tags
and assigned a unique ID attribute.
In the lower frame, I run a JS function that looks up the ID
using the DOM (getElementById ()) and then assigns the new
text to the innerText of that element. Under IE, this works
perfectly fine. Under NN7 the text in the upper frame doesn't
change (although it does appear that it is getting set).
Any ideas? A sample app appears below.
Thanks in advance,
Paul
[some minor clutter in the script below to ensure readability
and clean initialization]
[sample.html]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<FRAMESET border="0" cols="*" rows="95,*,38">
<FRAME name="topframe" src="sample_top .html" noresize>
<frame name="sample_bo ttom" src="sample_bot tom.html" noresize>
</FRAMESET>
[sample_top.html]
<frameset rows="*" cols = "125,*" frameborder="no " framespacing="0 "
border="0">
<frame src="sample_top left.html" scrolling="no" frameborder="no "
framespacing="0 " border="0" noresize>
<frame name="titlefram e" src="sample_top right.html" scrolling="no"
frameborder="no " framespacing="0 " border="0" noresize>
</frameset>
[sample_topleft. html]
<body>
<h2>[Logo]</h2>
</body>
[sample_topright .html]
<script language="JavaS cript">
var loaded = false;
</script>
<body onload="loaded = true;">
<table width="100%" border="0" cellspacing="0" cellpadding="0" >
<tr>
<td>
<h2>Some fixed text, graphics, whatever</h2>
</td>
</tr>
<tr><td><h4><sp an id="variable">T his text should
vary</span></h4></td>
</tr>
</table>
[sample_bottom.h tml]
<body>
<script language="JavaS cript">
var tries = 0;
var the_text = "None";
function set_variable(tx t) {
if (txt) {
the_text = txt;
} else {
txt = the_text;
}
if (top.topframe && top.topframe.ti tleframe &&
top.topframe.ti tleframe.loaded ) {
tries = 0;
_set_variable(t xt)
} else if (tries < 5) {
tries++;
setTimeout("set _variable()", 1000);
} else {
alert("Failed to load top frame");
}
}
function _set_variable(t xt) {
var doc = (top.topframe) ? top.topframe.ti tleframe.docume nt : null;
if (doc.getElement ById) {
elem = doc.getElementB yId('variable') ;
if (elem == null) {
alert("get by id: no element available");
}
} else if (doc.all) {
elem = doc.all("variab le");
alert("get all");
} else {
alert("can't access element");
elem = null;
}
if (elem) {
elem.innerText = "Variable text: " + txt;
} else {
alert( "Can't access variable" );
}
}
</script>
<!-- various page contents here... -->
<script language="JavaS cript">
set_variable("F ollow");
</script>
<center>
<a href="sample_bo ttom2.html">Fol low</a> Me
</center>
</body>
[sample_bottom2. html]
<body>
<script language="JavaS cript">
var tries = 0;
var the_text = "None";
function set_variable(tx t) {
if (txt) {
the_text = txt;
} else {
txt = the_text;
}
if (top.topframe && top.topframe.ti tleframe &&
top.topframe.ti tleframe.loaded ) {
tries = 0;
_set_variable(t xt)
} else if (tries < 5) {
tries++;
setTimeout("set _variable()", 1000);
} else {
alert("Failed to load top frame");
}
}
function _set_variable(t xt) {
var doc = (top.topframe) ? top.topframe.ti tleframe.docume nt : null;
if (doc.getElement ById) {
elem = doc.getElementB yId('variable') ;
if (elem == null) {
alert("get by id: no element available");
}
} else if (doc.all) {
elem = doc.all("variab le");
alert("get all");
} else {
alert("can't access element");
elem = null;
}
if (elem) {
elem.innerText = "Variable text: " + txt;
} else {
alert( "Can't access variable" );
}
}
</script>
<script language="JavaS cript">
set_variable("M e");
</script>
<center>
Follow <a href="sample_bo ttom.html">Me</a>
</center>
</body>
[end-of-sample-app]
appears in a top frame and a lower frame contains the content
for the application. One of the needs for this app is for a
status line in the upper frame to be updated when certain
actions are taken in the lower frame.
In the top frame, I have a line of text wrapped with SPAN tags
and assigned a unique ID attribute.
In the lower frame, I run a JS function that looks up the ID
using the DOM (getElementById ()) and then assigns the new
text to the innerText of that element. Under IE, this works
perfectly fine. Under NN7 the text in the upper frame doesn't
change (although it does appear that it is getting set).
Any ideas? A sample app appears below.
Thanks in advance,
Paul
[some minor clutter in the script below to ensure readability
and clean initialization]
[sample.html]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<FRAMESET border="0" cols="*" rows="95,*,38">
<FRAME name="topframe" src="sample_top .html" noresize>
<frame name="sample_bo ttom" src="sample_bot tom.html" noresize>
</FRAMESET>
[sample_top.html]
<frameset rows="*" cols = "125,*" frameborder="no " framespacing="0 "
border="0">
<frame src="sample_top left.html" scrolling="no" frameborder="no "
framespacing="0 " border="0" noresize>
<frame name="titlefram e" src="sample_top right.html" scrolling="no"
frameborder="no " framespacing="0 " border="0" noresize>
</frameset>
[sample_topleft. html]
<body>
<h2>[Logo]</h2>
</body>
[sample_topright .html]
<script language="JavaS cript">
var loaded = false;
</script>
<body onload="loaded = true;">
<table width="100%" border="0" cellspacing="0" cellpadding="0" >
<tr>
<td>
<h2>Some fixed text, graphics, whatever</h2>
</td>
</tr>
<tr><td><h4><sp an id="variable">T his text should
vary</span></h4></td>
</tr>
</table>
[sample_bottom.h tml]
<body>
<script language="JavaS cript">
var tries = 0;
var the_text = "None";
function set_variable(tx t) {
if (txt) {
the_text = txt;
} else {
txt = the_text;
}
if (top.topframe && top.topframe.ti tleframe &&
top.topframe.ti tleframe.loaded ) {
tries = 0;
_set_variable(t xt)
} else if (tries < 5) {
tries++;
setTimeout("set _variable()", 1000);
} else {
alert("Failed to load top frame");
}
}
function _set_variable(t xt) {
var doc = (top.topframe) ? top.topframe.ti tleframe.docume nt : null;
if (doc.getElement ById) {
elem = doc.getElementB yId('variable') ;
if (elem == null) {
alert("get by id: no element available");
}
} else if (doc.all) {
elem = doc.all("variab le");
alert("get all");
} else {
alert("can't access element");
elem = null;
}
if (elem) {
elem.innerText = "Variable text: " + txt;
} else {
alert( "Can't access variable" );
}
}
</script>
<!-- various page contents here... -->
<script language="JavaS cript">
set_variable("F ollow");
</script>
<center>
<a href="sample_bo ttom2.html">Fol low</a> Me
</center>
</body>
[sample_bottom2. html]
<body>
<script language="JavaS cript">
var tries = 0;
var the_text = "None";
function set_variable(tx t) {
if (txt) {
the_text = txt;
} else {
txt = the_text;
}
if (top.topframe && top.topframe.ti tleframe &&
top.topframe.ti tleframe.loaded ) {
tries = 0;
_set_variable(t xt)
} else if (tries < 5) {
tries++;
setTimeout("set _variable()", 1000);
} else {
alert("Failed to load top frame");
}
}
function _set_variable(t xt) {
var doc = (top.topframe) ? top.topframe.ti tleframe.docume nt : null;
if (doc.getElement ById) {
elem = doc.getElementB yId('variable') ;
if (elem == null) {
alert("get by id: no element available");
}
} else if (doc.all) {
elem = doc.all("variab le");
alert("get all");
} else {
alert("can't access element");
elem = null;
}
if (elem) {
elem.innerText = "Variable text: " + txt;
} else {
alert( "Can't access variable" );
}
}
</script>
<script language="JavaS cript">
set_variable("M e");
</script>
<center>
Follow <a href="sample_bo ttom.html">Me</a>
</center>
</body>
[end-of-sample-app]
Comment