View Single Post
  #4 (permalink)  
Old Dec 17th, 2006, 16:53
ukgeoff ukgeoff is offline
Most Reputable Member
Join Date: Apr 2006
Location: Cornwall, UK
Posts: 1,310
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Alerts: Only one wanted - How to?

Quote:
Originally Posted by snow View Post
I don't think there's a way to do it between pages with JavaScript - that I can remember anyway... I think you'd need some kind of session.

On the same page, to make it pop up only once you could do something like...

Code: Select all
 function pop() {
  if (done!=1) {
        alert("hey you! eggburger! farts!");
    done=1;
  }
}
Just off the top of my head after I haven't used it for a while - so there are probably much better solutions out there!
Be aware of a problem here that often catches out people new to JavaScript and other similar languages for that matter.

The variable you are setting, 'done' only exists inside the function, so once the function finishes, so the variable 'done' no longer exists. You would need to define the variable globally.
Reply With Quote