Re: document.write script errors
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.javascript archive

Re: document.write script errors

From: RobG <rgqld@iinet.net.au>
Date: Tue Nov 15 2005 - 02:47:07 CET

robert.waters@gmail.com wrote:
> Hello,
> When the following page is executed in IE6, it generates script errors
> ('object expected') for any function that is declared in an external
> .js file. Why is this???? This code works in Firefox 1.07 and 1.5.
> (The following code, when the body's onload event is triggered, simply
> rewrites the page using documentElement.innerHTML)

There is no public specification for what innerHTML should do or how it
should do it - so whatever it does is whatever it does and browsers will
vary in that.

For the record, on my machine your page loads twice in Firefox before it
becomes comatose, IE re-loads the page once.

[...]
>
> How can I get around this, if this is the method that I have to use?
>

Explain what you are trying to achieve and suggestions may be posted...
or not. Why you need to suck the HTML out of a document then simply
write it back again plumb evades me.

It has consequences such as you loss of the DOCTYPE, resulting in an
invalid document and it may cause IE (and perhaps other browsers) to
treat the page differently.

-- 
Rob
Received on Mon Nov 21 03:29:29 2005