In article <ctm27b$cdj$1@newsreader.wustl.edu>,
Paul Thompson <paul@wubios.wustl.edu> wrote:
[color=blue]
> I am working with a special tool which pre-processes the page. Using
> document.write, I am composing the page while it is loading, so I need
> to force a reprocess of the page AFTER the page loads.
>
> Is there some way to do that? That is, I want the browser to
> essentially act as if the composed page was the original page.[/color]
What is failing?
You only need to escape the </script> tag. An easier way to do this is:
<\/script>. When a browser sees, <script> it scans for the </script>
tags. Some browser ignore things in quotes in when doing this scan.
Hence the need for escaping.
See RobG's explains how to construct a string containing html. Grooge
won't let me point to one post but only a thred. Here is the thread:
http://groups-beta.google.com/group/...owse_thread/th
read/f8d72fff92b97c76/ddd4888398a775c1?q=robg+Cant+correctly+load+.js&_d o
ne=%2Fgroup%2Fcomp.lang.javascript%2Fsearch%3Fgrou p%3Dcomp.lang.javascrip
t%26q%3Drobg+Cant+correctly+load+.js%26qt_g%3D1%26 searchnow%3DSearch+this
+group%26&_doneTitle=Back+to+Search&&d#ddd4888398a 775c1
RobG Oct 14 2004, 8:17 pm
Subject: Re: Cant correctly load .js files when creating page
dynamically in IE
Here is RobG's code. Hope he doesn't mind.
<html>
<head>
<title>New Page</title>
<script type="text/javascript">
function loadWindow() {
var VE3DWindow = window.open('',
'VE3DWin','resizable=1,width=400,height=400')
var a = [
'<!DOCTYPE HTML PUBLIC ',
'"-//W3C//DTD HTML 4.01 Transitional//EN"',
'"http://www.w3.org/TR/html4/loose.dtd">',
'<html>',
'<head>',
'<meta http-equiv="Content-Type" ',
'content="text/html; charset=iso-8859-1">',
'<title>Untitled Document</title>',
'<script type="text/JavaScript" src="xx.js"></scr',
'ipt>',
'<script type="text/JavaScript">alert(location);</scr',
'ipt>',
'</head>',
'<body>',
'<p>Here is a page</p><p>here is some text</p>',
'<p>and some more text</p>',
'<form action=""><input type="button" ',
'value="Open Window"',
'onclick="xx();"></form>',
'</body>',
'</html>',
];
VE3DWindow.document.write(a.join(""))
VE3DWindow.document.close()
}
</script>
</head>
<body>
<form action="">
<input type="button" value="Open Window"
onclick="loadWindow();">
</form>
</body>
</html>
file xx.js:
function xx() {
alert('hi');
}
Robert