You are here: irt.org | FAQ | JavaScript | Window | Q413 [ previous next ]
Try this:
<script language="JavaScript"><!-- function myopen() { popupWindow=open('multiple.htm','windowName','resizable=no,width=400,height=300'); if (popupWindow.opener == null) popupWindow.opener = self; } //--></script> <form> <input type="text" size="40" name="resultfield"> <input type="button" value="Open" onClick="myopen()"> </form>
And then in multiple.htm:
<script language="JavaScript"><!-- function update() { var output = ''; for (var i=0;i < document.forms[0].selectfield.options.length;i++) { if (document.forms[0].selectfield.options[i].selected) { output += document.forms[0].selectfield.options[i].text + ' '; } } opener.document.forms[0].resultfield.value = output; window.close(); } //--></script> <form onSubmit="return false"> <select multiple name="selectfield"> <option>Monday <option>Tuesday <option>Wednesday <option>Thursday <option>Friday <option>Saturday <option>Sunday </select> <p> <input type="button" value="Update" onClick="update()"> </form>