faqts : Computers : Programming : Languages : Perl

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

61 of 86 people (71%) answered Yes
Recently 6 of 10 people (60%) answered Yes

Entry

How can i close the active window (eg. a javascript popup) with a form, when the visitor pushes the submitt-button?

Jun 26th, 2001 03:51
Iain Bruce, Thomas Hernes,


In with the "input type=submit" tag, add
onClick="javascript:window.close()"
so 
<input type=submit value="Send stuff, and close window" 
onClick="javascript:window.close()">
If you are doing it with Perl, you can add the onClick to the submit 
like this (assumes you are using CGI.pm)
$query->submit(-value=>'Send stuff, and close window',
               -onClick=>'javascript:window.close()');
I have not been able to test the syntax of the Perl solution but from 
memory believe it works. The first answer has been tested and does what 
you request.
One way or another - hope this helps.