Hi
I've been trying to work out a tool for some very inexperienced users to use to generate new pages for a site within a fairly simple format. I'm having trouble with using document.write to create the javascript to open a further new window to show an image. I've as far as this:
<HTML>
<HEAD>
<SCRIPT TYPE="text/javascript" LANGUAGE="JavaScript">
<!-- hide
function openWin() {
newWin=open("", "displayWindow",
"width=600,height=400,toolbar=yes,menubar=yes,scroll=yes,status=yes");
// open document for further output
newWin.document.open();
// create document
newWin.document.write('<HTML>\n<HEAD>\n<TITLE>New Window 1</TITLE>\n');
// START OF SCRIPT FOR NEW PAGE
newWin.document.writeln('<SCRIPT TYPE="text/javascript"; LANGUAGE="JavaScript">');
newWin.document.writeln('<!-'+'-hide');
newWin.document.writeln('function openWin() {');
newWin.document.writeln('newWin=open("picture.html","displaywindow",width=300,height=300,toolbar=yes,menubar
=yes,scroll=yes)\n');
newWin.document.writeln('}\n\n');
newWin.document.writeln('//'+'-->');
newWin.document.writeln('</SC'+'RIPT>\n');
//END OF SCRIPT FOR NEW PAGE
newWin.document.write('</HEAD>\n<BODY>\n');
newWin.document.write('<TABLE>\n<TR>\n<TD>\n');
newWin.document.write('<A HREF=http://www.webdeveloper.com/forum/archive/index.php/javascriptnClick="openWin()">window3</A>\n');
newWin.document.write('</TD>\n</TR>\n</TABLE>\n');
newWin.document.write('</BODY>\n</HTML>');
newWin.document.close();
}
//-->
</SCRIPT>
</HEAD>
<BODY>
<FORM>
<INPUT TYPE="button" VALUE=http://www.webdeveloper.com/forum/archive/index.php/"clickme" onClick="openWin()">
</FORM>
</BODY>
</HTML>
I can't for the life of me spot the flaw in the code this generates but the link in the new (2nd) window when clicked just writes *openWin()* in itself rather than opening another new (3rd) window. I would also appreciate knowing if this works in other browsers 'cos I'm doing this at work where all I have is IE6 on win2k.
Thanx
IanI
I've been trying to work out a tool for some very inexperienced users to use to generate new pages for a site within a fairly simple format. I'm having trouble with using document.write to create the javascript to open a further new window to show an image. I've as far as this:
<HTML>
<HEAD>
<SCRIPT TYPE="text/javascript" LANGUAGE="JavaScript">
<!-- hide
function openWin() {
newWin=open("", "displayWindow",
"width=600,height=400,toolbar=yes,menubar=yes,scroll=yes,status=yes");
// open document for further output
newWin.document.open();
// create document
newWin.document.write('<HTML>\n<HEAD>\n<TITLE>New Window 1</TITLE>\n');
// START OF SCRIPT FOR NEW PAGE
newWin.document.writeln('<SCRIPT TYPE="text/javascript"; LANGUAGE="JavaScript">');
newWin.document.writeln('<!-'+'-hide');
newWin.document.writeln('function openWin() {');
newWin.document.writeln('newWin=open("picture.html","displaywindow",width=300,height=300,toolbar=yes,menubar
=yes,scroll=yes)\n');
newWin.document.writeln('}\n\n');
newWin.document.writeln('//'+'-->');
newWin.document.writeln('</SC'+'RIPT>\n');
//END OF SCRIPT FOR NEW PAGE
newWin.document.write('</HEAD>\n<BODY>\n');
newWin.document.write('<TABLE>\n<TR>\n<TD>\n');
newWin.document.write('<A HREF=http://www.webdeveloper.com/forum/archive/index.php/javascriptnClick="openWin()">window3</A>\n');
newWin.document.write('</TD>\n</TR>\n</TABLE>\n');
newWin.document.write('</BODY>\n</HTML>');
newWin.document.close();
}
//-->
</SCRIPT>
</HEAD>
<BODY>
<FORM>
<INPUT TYPE="button" VALUE=http://www.webdeveloper.com/forum/archive/index.php/"clickme" onClick="openWin()">
</FORM>
</BODY>
</HTML>
I can't for the life of me spot the flaw in the code this generates but the link in the new (2nd) window when clicked just writes *openWin()* in itself rather than opening another new (3rd) window. I would also appreciate knowing if this works in other browsers 'cos I'm doing this at work where all I have is IE6 on win2k.
Thanx
IanI