PDA

View Full Version : suppress appearance JavaScript window more than one time


d2e8kk
10-11-2005, 03:35 PM
Hello!
I have little problem with Javascript.
I written PHP-form that send message "Updated successfully" with help JavaScript:
print "
<Script language=JavaScript>
alert('Updated successfully');
</Script>
";
Press "Ok" - message window closed.
And if now I shall press browser's button "Back" I shall receive this message again. Who known what I need to do for suppress appearance this window more than one time?
Thanx.

pccode
10-11-2005, 06:39 PM
Try this:


echo "
<script type=\"text/javascript\">
onload = function() {
alert('Successfully Updated');
}
</script>";

rm-f
10-11-2005, 06:55 PM
onload: extract showAlert value from cookie

if(showAlert == true) {
alert('...');
showAlert = false;
document.cookie = 'showAlert=false'; // update cookie
}