") } var NewWin2=null function openNewWin2() { if(NewWin2 && !NewWin2.closed) NewWin2.close() NewWin2=window.open("", "NewWin2", "resizable=yes,height=125,width=350,top=350,left=0") NewWin2.document.write("
") NewWin2.document.write("
") } var NewWin3=null function openNewWin3() { if(NewWin3 && !NewWin3.closed) NewWin3.close() NewWin3=window.open("", "NewWin3", "resizable=no,height=165,width=200,top=350,left=400"); NewWin3.document.write("
") NewWin3.document.write("
") } var NewWin4=null function openNewWin4() { if(NewWin4 && !NewWin4.closed) NewWin4.close() NewWin4=window.open("", "NewWin4", "toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,height=400,width=700,top=100,left=50"); NewWin4.document.write("
") NewWin4.document.write("
") } function winClose(){ if(NewWin && !NewWin.closed) NewWin.close() if(NewWin2 && !NewWin2.closed) NewWin2.close() if(NewWin3 && !NewWin3.closed) NewWin3.close() if(NewWin4 && !NewWin4.closed) NewWin4.close() } //-->
Put anything you want into a pop-up window
You can create a pop-up window with Java script using document.write that includes just about anything you want, without having to link to a separate htm document. Try the examples above. They will close by themselves when you leave or close the page.
Tips:
-The difference between document.write and document.writeln is that the latter is supposed to add a line break at the end. But Netscape needs a break or other tag at the end to print the last line anyway; I use write and include a break.
-To have no margins around a picture in a window, specify "topmargin='0' leftmargin='0' marginheight='0' marginwidth='0'"; one is for IE, the other for Netscape.
-Keep text windows resizable to allow for different browser text size settings.
-If you do not specify closing the windows before opening, the contents will add copies of themselves every time you click on the link.