Home Articles FAQs XREF Games Software Instant Books About Feedback Search Site-Map
irt.org logo

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

irt.org | Knowledge Base | JavaScript | Form 11 | Q1129 [ previous next ]

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

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?'


Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


Last Updated: 30th March 2008. Maintained by: Martin Webb and Michel Plungjan
irt.org liability, trademark, document use, privacy statement and software licensing rules apply.
Copyright © 1996-2008 irt.org, All Rights Reserved.