document.write to a nested division

wxdqz

New Member
This should be simple but the solution evades me. A message is changed on 'mouseover'. It works corectly in IE but I cannot get it to work in NS4xx.

If I use
with (document.main.document) {..
the contents of the 'main div' changes as I would expect, but I want to change the 'message div'.

I tried (with various combinations)
with (document.main.document.content.document.msg.document)
and get a '.... has no properties' error.

<html><head><title>Change text</title>
<script type="text/javascript">
<!--
var NS = (document.layers) ? true : false;
var msgAry = new Array (
"Msg0 - Ac ne quid ad totius rei pertinens notitiam praetermisisse videar..",
"Msg1 - verum ad amorem quoque commissae rei instigent sitque nunc mihi ab..",
"Msg2 - Neque enim ullum omnis actus certius fundamentum crediderim, aut.."
);

function chgMsg(no) {
if (NS) {
with ( this.message.document ) { open(); write(msgAry[no]); close(); }
} else { this.message.innerHTML = msgAry[no]; }
}
//-->
</script>
</head>

<body bgcolor="#ffffff">
<div id="main" style="position:absolute; top:30; left:210">
<h3>Change the text on a webpage</h3>
<div id="content" class="maintxt">
Uses mouseover to change text.
<p>
<a href=http://www.webdeveloper.com/forum/archive/index.php/"#" onmouseover="chgMsg(0); return false" class="subhead">"Msg0"</a><br>
<a href="#" onmouseover="chgMsg(1); return false" class="subhead">"Msg1"</a><br>
<a href="#" onmouseover="chgMsg(2); return false" class="subhead">"Msg2"</a><br>
<table width="100%" height=100><tr><td class="maintxt">
<div id="message">
Msg0 - Ac ne quid ad totius rei pertinens notitiam praetermisisse videar..
</div>
</td></tr></table>
</p>
</div>
</div>
</body>
</html>
Is this simply something that cannot be done in NS4xx?
 
Back
Top