View Full Version : reload after alert box
chesneil
06-24-2003, 07:06 PM
Hi all,
A silly question I'm sure, but I don't do much JS work. I want a page to refresh after an alert box is clicked. How do I do it?
I've tried various methods with self.reload() but the correct one eludes me :mad:
Thanks in advance.
Choopernickel
06-24-2003, 07:08 PM
if (alert('something') ) { location.reload(); }
cheesebagpipe
06-24-2003, 07:11 PM
Interesting conditional.
alert('blah'); window.location.reload(true);
Choopernickel
06-24-2003, 07:19 PM
well, chesneil did say "alert box is clicked" - I believe that typing escape cancels the alert, effectively returning false, does it not? it's been a while since I used alert for anything outside debugging.
cheesebagpipe
06-24-2003, 10:32 PM
afaik, window.alert() always returns 'undefined'. Might be thinking of .confirm()....
chesneil
06-25-2003, 01:12 AM
Thanks for your replies. OK, I didn't think it was relevant, but the Javascript is in the middle of php. None of the above work. After I click the alert button the script just continues running. Here's what I have:
<?php
if ($submit=="ADD TO DATABASE") {
if ($secondmatsmonth!=0 &&$firstmatsmonth!=0 && (($secondmatsmonth-$firstmatsmonth)!=6)) {
?>
<script language="JavaScript">
<!--
alert('blah'); window.location.reload(true);
//-->
</script>
<?php
}
Any reason why it's not working...and an alternative??
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.