Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org
#

Q1129 How can I use form fields to control the properties of a new popup window?

You are here: irt.org | FAQ | JavaScript | Form | 11 | Q1129 [ previous next ]

Try:

<script language="JavaScript"><!--
function openWin(theForm) {
    w = theForm.theWidth.value;
    h = theForm.theHeight.value;
    props = 'width='+w+',height='+h;
    if (theForm.theStatus.checked) props += ',status';
    if (theForm.theMenubar.checked) props += ',menubar';

    window.open(theForm.pagename.value,'winname',props);
}
//--></script>

<form onSubmit="openWin(this)">
Page: <input type="text" name="pagename"><br>
Status:<input type="checkbox" name="theStatus"><br>
Menu:<input type="checkbox" name="theMenu"><br>
<input type="button" onClick="openWin(this.form)" value="open">
</form>

Feedback on 'Q1129 How can I use form fields to control the properties of a new popup window?'

©2018 Martin Webb