SitePoint Sponsor |
|
User Tag List
Results 1 to 6 of 6
-
Sep 30, 2003, 02:40 #1
- Join Date
- Aug 2003
- Location
- Sheffield
- Posts
- 179
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
not sure if correct forum but closing function!?!
Hello,
not sure if correct forum... and i do apologise if it is
i want to close a website window 20 seconds after the button has been clicked... i have put this in so far
any help woluld be appreciate.... this is the only javascript i need to do
[code]
<title>Email Address</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script type="text/javascript">
<!-- if (window.opener) window.onblur = function() { setTimeout(function())
{ window.close(); }, 20); }; //--> </script>
<?
$course_id=$id;
# this must be at the top of the entire page
# because we may need to do a redirection (see below)
if ( isset( $_POST['EMAIL'])) {
if( !eregi( "^[_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,4}$", $_POST['EMAIL'])) {
# Invalid email address format
die( "Invalid E-mail. Please go back and try again." );
}
else {
list( $user, $domain) = split("@", $_POST['EMAIL']);
if( !getmxrr( $domain.'.', $MXHost)) {
if( !fsockopen( $domain, 25, $errno, $errstr, 30)) {
# Invalid email host
die( "E-mail cannot be authenticated. Please go back and try again." );
}
else {
# All good, email appears to be valid!
# modify the line below to use your website's URL
header( "Location: http://www.burngreave.net/~fizlar/mail.php?EMAIL=" . $_POST['EMAIL'].'&'.$course_id);
# email info passed on to the mail.php page.
exit;
}
}
}
}
?>
<html>
<body>
<form method="post" action="">
<input type="text" name="EMAIL" value="" />
<input type="submit" value="Submit" />
</form>
</body>
</html>
<body>
</body>
</html>
[code]
-
Sep 30, 2003, 02:58 #2
- Join Date
- Jul 2003
- Location
- Kortrijk, Belgium, Europe, the world
- Posts
- 203
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
I use this to achieve what you want.
Code:<html><head><script language='javascript'> var nrOfSeconds = 20; function scd() { nrOfSeconds -= 1; if (nrOfSeconds == 0) { self.close(); } } </script> </head> <body> <a href="#" onClick="setInterval('scd()',1000)">Close in 20 seconds</a> </body> </html>
-
Sep 30, 2003, 03:09 #3
- Join Date
- Aug 2003
- Location
- Sheffield
- Posts
- 179
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
ok cheers....But
i dont want users to click on the link
i want them went they submit the email address the web browser to count from the second the subit button has been clicked for passing the email!
-
Sep 30, 2003, 03:44 #4
- Join Date
- Jul 2003
- Location
- Kortrijk, Belgium, Europe, the world
- Posts
- 203
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Why do you want to wait 20 seconds after the submit button has been pressed?
-
Sep 30, 2003, 03:48 #5
- Join Date
- Aug 2003
- Location
- Sheffield
- Posts
- 179
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
ahh well a message comes up and says thank you and email has been sent this window will now automatically will close now
20 sec 5 sec whatever... is it possible?
-
Sep 30, 2003, 06:38 #6
- Join Date
- Sep 2003
- Location
- Reston, VA
- Posts
- 22
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
In that case, once the user clicks the link, you can count down the 20 seconds and then call the .submit() method on the form. Of course this means that the form won't be submitted until the 20 seconds are up.
Bookmarks