window.open() and the JavaScript content in the new window.

I

IveCal

Hello, I created the following sample HTML/JavaScript of my problem. I
have a MAIN page. When it is loaded, I want to open a new window that
contains the same JavaScript as the main window:

<script type="text/javascript" >
alert("OK");
</script>

My problem here is the new window have an error: Object expected. This
is the source code of the new window:

<html><body><table><TR>
<SCRIPT type=text/javascript>
alert("OK");
</SCRIPT>
</TR></table></body></html>

I realize the problem is in the second line where the text/javascript
is not enclosed in double quotes so that it looks like this: <SCRIPT
type="text/javascript">

I have no idea how to solve this problem. Please help. Thanks a lot.


------------------------------------------------------------------

Sample Main HTML





<script language="javascript">
function replaceQuote(strTemp)
{
return strTemp.replace(/"/gi,"'");
}
</script>


<html>
<body>
<table>
<tbody name="test" id="test">
<tr>
<script type="text/javascript" >
alert("OK");
</script>
</tr></tbody>
</table>

<table>
<script type="text/javascript">

winReport=window.open('','winReport','width=900,height=500,left=50,top=100,menubar=0,toolbar=0,status=0,scrollbars=1,resizable=0,titlebar=0');
winReport.document.write('<html>');
winReport.document.write('<body>');
winReport.document.write('<table>');
winReport.document.write((document.all.test.innerHTML));
winReport.document.write('</table>');
winReport.document.write('</body>');
winReport.document.write('</html>');
</script>
</table>

</body>
</html>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top