View Full Version : Alert Box Help

06-04-2006, 12:30 PM
Okay i'm building a CD-ROM navigation system.

Upon opening the Index.html file, i have a javascript alert in place telling the best resolution to run the CD-ROM at which pops up.

This is fine, and everytime i click on 'Home' in my navigation bar it reopens Index.html which i want it to do. However the javascript alert also loads which is a nuiscance. Does anybody know how to get it to run only once?

The code is the basic script so far -

<script type="text/javascript"> alert("This CD-ROM is best viewed at a resolution of 1280 x 1024 pixels");</script>

I am using a frameset and i have placed the alert in the main content window, as it wouldn't work when i placed it in the actual frameset file. Could this have something to do with it?


06-04-2006, 02:09 PM
look into cookies


06-05-2006, 12:18 AM
I don't quite understand sorry.

06-05-2006, 12:21 AM
You need to set a cookie on the users system that tells the script its been ran once. Look into reading and writing javascript cookies.

06-05-2006, 12:40 PM
Okay.. that sounds like a good idea. However i wish for it to happen everytime the CD-ROM is booted. Is that possible?

06-05-2006, 08:39 PM
You can probably use onunload to delete the cookie so it gets deleted when the browser is exit.

onunload = functiontodeletecookie;
or even onbeforeunload which I think is IE only.

onbeforeunload = functiontodeletecookie;