This is a discussion on "Alerts: Only one wanted - How to?" within the JavaScript Forum section. This forum, and the thread "Alerts: Only one wanted - How to? are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
Alerts: Only one wanted - How to?
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
|||
|
Alerts: Only one wanted - How to?
(bear w/ me, there's a point coming up in paragh2)
this is kinda crazy-- i've been doing html for almost 10 years-- an last night was the first that the whole javascript thing finally came to me. don't get me wrong-- i've used it tons of times, and even written stuff-- like the Hide-a-div / css display none thing that's quite popular, etc.-- but for some reason-- it never really seemed to make sense-- blah- blah-- point is, i think i might finally have my head around it. for one thing-- i never noticed that event handlers are actually an HTML thing-- sorta. kind of like the female to javascript's male, so to speak, right? (only the gods would know why). so i've got experience, but i'm going to ask some really dull questions about javascript here (and probably in the future, depending on what kind of response i get from the crowd. so i hope the martini's are good tonight) the INQUIRY i only want to have one alert popup instead of every time someone passes over the anchor eventhandler (wow! it's fun to say event handler!). it is annoying enough w/out it happening over and over. is there a way to make it do only one per visit-- even if someone comes back to the page again before they finally leave the site? the code is essentially:
|
|
|
|
|||
|
Re: Alerts: Only one wanted - How to?
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...
|
|
||||
|
Re: Alerts: Only one wanted - How to?
You can use cookies to do this, but more importantly, you need to know that JavaScript and HTML are completely separate. You should never have JavaScript inside an HTML document. Use the script take to link externally.
The document.getElementById("something"); is your friend. Learn to use and love unobtrusive JavaScript. |
|
|||
|
Re: Alerts: Only one wanted - How to?
Quote:
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. |
![]() |
| Tags |
| any, anymore, can, complain, fun, jesus, not, okay, only, tags, this |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Please help me add some random alerts to my code | meddow | JavaScript Forum | 0 | Nov 24th, 2006 01:04 |
| Wanted to say Hi! | dchesterton | Introduce Yourself | 8 | May 8th, 2006 18:43 |
| Hi everyone, I'm new here and just wanted to say hello | Saleem | Introduce Yourself | 6 | Nov 30th, 2005 13:50 |
| Else and alerts | chuckcampbell | JavaScript Forum | 8 | Oct 5th, 2005 18:44 |
| Just Wanted to Say Hello | hostlegal | Introduce Yourself | 2 | Jun 27th, 2005 09:54 |