Pop-up Windows code
To open a new window from a link, here are a couple of examples...
<a href="index.htm" onClick="window.open('http://someurl.htm', 'NewWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=640,height=480')" class="navlink" OnMouseOver="window.status='Menu Link'; return true;" OnMouseOut="window.status=''; return true;">Menu Link</a>
<a href="index.html" onClick="window.open('index.html','newWindow', 'toolbar=yes,scrollbars=yes,resizable=yes,menubar=yes,location=yes,status=no,width=775,height=400'); return false" class="link"> Index</a>
*It was important to leave no spaces between commas for the toolbar info (back when I first learned to do this, but spaces may be okay now)
<body> Example: 3 pop-ups <script language="JavaScript"> aWindow = window.open("red.html", "firstWindow", "toolbar=no,width=100,height=300,status=no,scrollbars=yes,resizable=no,menubar=no"); bWindow = window.open("white.html", "secondWindow", "toolbar=no,width=300,height=100,status=no,scrollbars=yes,resizable=yes,menubar=yes"); cWindow = window.open("blue.html", "thirdWindow", "toolbar=yes,width=200,height=200,status=no,scrollbars=yes,resizable=no,menubar=no"); // --> </script> <h1 align=center>Check out my cool windows!</h1> <ul> <li><a href="green.html" target="firstWindow">Change red window to green.</a></li> <li><a href="green.html" target="secondWindow">Change white window to green.</a></li> <li><a href="green.html" target="thirdWindow">Change blue window to green.</a></li> </ul> </body> ------------------------------------------------------------------------- in the code for the actual pop-up window (red.html) : <form> <input type = "button" value = "Close" onClick = "if (confirm('Are you sure you want to close this window?')) $ </form> ------------------------------------------------------------------------- <html><head> Example: MadLibs <script language="JavaScript"> function makeLibs() { story = "<html><head><title>Julius Caesar</title></head>" + "<body bgcolor='#D2FFFF'><h1 align=center>Julius Caesar</h1>" + "<p>Friends, Romans, " + document.madlibs.innoun.value + " lend me your " + document.madlibs.inbody.value + "; I come " + " to " + document.madlibs.inverb.value + " Caesar, not to praise him. " + " The evil that men do lives after them, the good is oft interred with their " + document.madlibs.inname.value + "; so let it be with " + document.madlibs.inpolt.value + ". The noble Brutus hath told you Caesar was " + document.madlibs.inadjv.value + "; if it were so, it was a grievous fault." + "<form><input type = 'button' value = 'Play again?'" + "onClick =\"if (confirm('Are you sure you want to play again?')) {" + "window.opener.location = 'madlibs-hack2.html'; window.close ();}" + "else (alert('Ok, this story will not close yet.'));\"></form></p></body></html>"; libsWin = window.open("","","width=300,height=250,scrollbars=yes"); libsWin.document.write(story); libsWin.document.close(); } </script></head> <body bgcolor="#FFE1FF" onLoad = "document.madlibs.innoun.focus();;"> <form name="madlibs"> <table border=0 cellpadding=5> <tr><td colspan=2>To create an amusing 'madcap-liberation,'<br>just fill in the boxes below...<br></td></tr> <tr><td>Plural Noun:</td><td><input type="text" name="innoun"></td></tr> <tr><td>Part of Body:</td><td><input type="text" name="inbody"></td></tr> <tr><td>Verb:</td><td><input type="text" name="inverb"></td></tr> <tr><td>Name:</td><td><input type="text" name="inname"></td></tr> <tr><td>Politician:</td><td><input type="text" name="inpolt"></td></tr> <tr><td>Adjective:</td><td><input type="text" name="inadjv"></td></tr> <tr><td></td><td><br><input type="button" value="Create Story" onClick = "makeLibs()"></td></tr> </table></form></body></html>




