New Window Laboratory
<HTML>
<HEAD>
<TITLE>window.open() Options</TITLE>
<SCRIPT LANGUAGE="JavaScript">
function makeNewWind(form) {
var attr = "HEIGHT=300,WIDTH=300"
for (var i = 0; i < form.elements.length; i++) {
if (form.elements[i].type == "checkbox") {
attr += "," + form.elements[i].name + "="
attr += (form.elements[i].checked) ? "yes" : "no"
}
}
var newWind = window.open("http://www.java2s.com","subwindow",attr)
}
</SCRIPT>
</HEAD>
<BODY>
<FORM>
<B>Select new window options:</B>
<TABLE>
<TR>
<TD COLSPAN=2>All Browsers Features:</TD>
</TR>
<TR>
<TD><INPUT TYPE="checkbox" NAME="toolbar">toolbar</TD>
<TD><INPUT TYPE="checkbox" NAME="location">location</TD>
</TR>
<TR>
<TD><INPUT TYPE="checkbox" NAME="directories">directories</TD>
<TD><INPUT TYPE="checkbox" NAME="status">status</TD>
</TR>
<TR>
<TD><INPUT TYPE="checkbox" NAME="menubar">menubar</TD>
<TD><INPUT TYPE="checkbox" NAME="scrollbars">scrollbars</TD>
</TR>
<TR>
<TD><INPUT TYPE="checkbox" NAME="resizable">resizable</TD>
<TD><INPUT TYPE="checkbox" NAME="copyhistory">copyhistory</TD>
</TR>
<TR>
<TD COLSPAN=2 ALIGN="middle"><INPUT TYPE="button" NAME="forAll"
VALUE="Make New Window" onClick="makeNewWind(this.form)"></TD>
</TR>
</TABLE>
<BR>
</FORM>
</BODY>
</HTML>
Related examples in the same category