Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

top.wOut.document is null or not an object?

Status
Not open for further replies.

MarkWaddington

Programmer
Aug 19, 2002
64
GB
Hi!

I have added a chatroom script to my website, and every time I enter the room the following error occurs: Error: 'top.wOut.document is null or not an object'

To put it into context, here's the script of the page..

toOut = '<font class=&quot;sysmessage&quot;><center>You have entered the chat.<br>Be fair, and please be civil or else you will be swiftly removed</center></font>';
if (document.all) {
top.wOut.document.body.innerHTML += toOut;
} else {
top.wOut.document.write(&quot;<html><style>BODY {font-family: Verdana, sans-serif; color: #000055; font-size: 12px;} </style><body bgcolor='#FFFFFF'>&quot;);
top.wOut.document.write(toOut);
}
function refresh() {
window.location='receive.php?rid=1&uid=2&username=Mark&tz=0&msgLastCheck=1031144788&allowsounds=1&lang=english';
}


Please can somebody help me! I'm lost with all this, somebody said it might be a cookie error and that it shouldn't happen on all computers.. but every computer i've tried it does happen!

Any help would be greatly appreciated.

Regards,

Mark Waddington.
 
I'm sure you've made an error in object referencing.
This is how to make it (cross-browser solution):
[tt]
if (document.all || document.getElementById)
{
cross_el=document.getElementById? document.getElementById(&quot;changing_div&quot;):document.all.changing_div;
cross_el.innerHTML+=toOut;
}
else if (document.layers){
document.layer1.document.write(toOut);
document.layer1.document.close()
}
[/tt]
I don't know what is &quot;top&quot; and &quot;wOut&quot; in your code, that's why I changed all elements names.
&quot;changing_div&quot; corresponds to <div id=&quot;changing_div&quot;>
and
&quot;layer1&quot; corresponds to the <layer id=&quot;layer1&quot;> - it should be added for compatibility with NN4.x to make the following structure:

<layer id=&quot;layer1&quot;>
<div id=&quot;changing_div&quot;>
c o n t e n t
</div>
</layer>

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top