|
This script is a little different than the script we've used in most of our other examples. The main difference is that with a link we open the popup with the link's URL, then cancel the onClickonSubmit
Line 1 begins the script element and line 2 begins the comment that should surround every script.
Line 3 begins the popupform() function. popupform() takes two arguments. The first argument,
myform, refers to the form itself. The second argument, windowname, sets a unique name for the popup window.
Line 4 has the opening bracket for the
popupform() function. Line 5 tests for the
window.focus method which is required to bring the popup to the front every time.
Line 6 opens the popup. Notice that we don't give the popup
a URL. When the popup opens it's blank.
Line 7 sets the
target property of the form to the name of the popup, so when the form opens it targets the popup instead of the current page.
8 returns true. Technically this line isn't needed because in the
onSubmitreturn. However, it's easy to forget and put a return statement in... 8 makes the script a little more fault tolerant.
Line 9 closes the function, 10 closes the comment, and 11 closes the script.
Copyright 1997-2002 Idocs Inc. Content in this guide is offered freely to the public under the terms of the Open Content License and the Open Publication License. Contents may be redistributed or republished freely under these terms so long as credit to the original creator and contributors is maintained.