PDA

View Full Version : close pop-up with mozilla browsers


subsol
05-29-2002, 01:40 PM
I've created a pop-up for a newsletter subscription on a site I'm working on.

What I'm trying to do is have the email info be submitted and the pop-up window close when the user clicks the "subscribe" button.

I've managed to do this successfully with IE but can not get the information to submit or get the window to close on mozilla based browsers. Here's the entire code:

<html>
<head>
<title>Free Newsletter</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="style.css" type="text/css">
</head>

<body bgcolor="E4EFF0" text="#000000">
<table width="250" border="1" cellspacing="0" cellpadding="10" bordercolor="003399" bgcolor="#FFFFFF">
<tr>
<td>
<div align="center">
<p class="headblack">FREE newsletters from XXXXX XXXXXXX</p>
<form name="nl_cc_form_popup" method="post" action="/nl_subscribe.php" target="mainwin">
<p align="left" class="bodyblack">Email address:
<input type="text" name="nl_form_email" size="30" maxlength="80">
</p>
<table width="226" border="0" cellspacing="0" cellpadding="5">
<tr>
<td valign="top" width="34">
<input type="checkbox" name="checkbox_corp" value="checkbox" checked>
</td>
<td width="192">
<p> class="bodyblack"><strong>XXXXXXXX XXXXXXXX</strong>
- XXXXXXXXXXX XXXXXX.</p>
</td>
</tr>
<tr>
<td valign="top" width="34">
<input type="checkbox" name="checkbox_cc" value="checkbox" checked>
</td>
<td width="192">
<p align="left" class="bodyblack"> <strong>XXXXXXXXXXX XXXXXX</strong>
- XXXXXXXXXXX XXXXXX.</p>
</td>
</tr>
</table>
<p align="center" class="bodyblack">
<input type="image" name="submit" src="/images/butt_subscribe_whitebg.jpg" width="72" height="21" onClick="window.close()">
</p>
</form>
</div>
</td>
</tr>
</table>
</body>
</html>


What can I do to have the information submitted and pop-up window close on both IE and Mozilla browsers... without having to create 2 different pop-ups?

Jon Hanlon
05-31-2002, 02:08 AM
An onclick event is processed before any corresponding submit event. Put in a delay of, say, 2.5 seconds to give the form a chance to submit first:

<input type="image" name="submit" src="/images/butt_subscribe_whitebg.jpg" width="72" height="21" onClick="setTimeout('window.close()',2500)">