R
robert.waters
Hello,
I am dynamically editing the contents of a page and using
document.write() to reload the new, edited content. However, on the
new page, any calls to functions located in external .js files (fyi:
same domain) fail with 'object expected' (IE6). If I subsequently
reload the page, everything works. Also, if I inline this code,
everything works.
Here is an example: (called from body onload event)
(This just rewrites the page with the function to rewrite it removed;
what I'm doing is more complicated)
start
<script src="path-to-script.js">
<script>
function test() {
// I'm actually using xmlhttp GET (irrelevant)
var h = document.getElementByTagName('html').innerHTML;
h = h.replace(/start(.*?)end/m,'');
document.open();
document.write(h);
document.close();
}
</script>
end
<script>call-function-from-file(parameters);</script> <---- error
object expected
I *really* don't want to inline the code, as it is complicated and
voluminous.
I've played with other methods of executing the document.write(), using
setTimeout(), different parameters to document.open(), different
attributes for the script tag, etc... - everything is the same.
There is no evidence that the browser is even attempting to load these
files; if I remove them from the server completely, the errors are
exactly the same.
Any help is appreciated.
Thanks in advance,
Robert Waters
I am dynamically editing the contents of a page and using
document.write() to reload the new, edited content. However, on the
new page, any calls to functions located in external .js files (fyi:
same domain) fail with 'object expected' (IE6). If I subsequently
reload the page, everything works. Also, if I inline this code,
everything works.
Here is an example: (called from body onload event)
(This just rewrites the page with the function to rewrite it removed;
what I'm doing is more complicated)
start
<script src="path-to-script.js">
<script>
function test() {
// I'm actually using xmlhttp GET (irrelevant)
var h = document.getElementByTagName('html').innerHTML;
h = h.replace(/start(.*?)end/m,'');
document.open();
document.write(h);
document.close();
}
</script>
end
<script>call-function-from-file(parameters);</script> <---- error
object expected
I *really* don't want to inline the code, as it is complicated and
voluminous.
I've played with other methods of executing the document.write(), using
setTimeout(), different parameters to document.open(), different
attributes for the script tag, etc... - everything is the same.
There is no evidence that the browser is even attempting to load these
files; if I remove them from the server completely, the errors are
exactly the same.
Any help is appreciated.
Thanks in advance,
Robert Waters