1 <head> 2 <script> 3 function timerFired() 4 { 5 document.getElementById("timerResult").firstChild.data = "Timer fired!"; 6 } 7 8 function closeModal() { 9 window.returnValue = document.form.toWindow.value; 10 window.close(); 11 } 12 13 function init() 14 { 15 document.form.fromWindow.value = window.dialogArguments; 16 } 17 </script> 18 </head> 19 <body onload="init()"> 20 <form name="form"> 21 <p>Here is the text from the main window: <input name="fromWindow"></p> 22 <p>Type text here to be sent back to the main window: <input name="toWindow" value="from modal window"></p> 23 <p>Then, push this button: <input type="button" value="Close" onClick="closeModal()"></p> 24 <p>Push this button to test timer: <input type="button" value="Test Timer" onClick="setTimeout(timerFired, 0)"></p> 25 <p id="timerResult">Timer did not fire yet.</p> 26 </form> 27 </body> 28