Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6

Thread: Alert Box Help

  1. #1
    New Coder
    Join Date
    Jun 2006
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Alert Box Help

    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?

    Thanks.

  • #2
    Senior Coder A1ien51's Avatar
    Join Date
    Jun 2002
    Location
    Between DC and Baltimore In a Cave
    Posts
    2,717
    Thanks
    1
    Thanked 94 Times in 88 Posts
    look into cookies

    Eric
    Tech Author [Ajax In Action, JavaScript: Visual Blueprint]

  • #3
    New Coder
    Join Date
    Jun 2006
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I don't quite understand sorry.

  • #4
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    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.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #5
    New Coder
    Join Date
    Jun 2006
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Okay.. that sounds like a good idea. However i wish for it to happen everytime the CD-ROM is booted. Is that possible?

  • #6
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    You can probably use onunload to delete the cookie so it gets deleted when the browser is exit.
    Code:
    onunload = functiontodeletecookie;
    or even onbeforeunload which I think is IE only.
    Code:
    onbeforeunload = functiontodeletecookie;
    ||||If you are getting paid to do a job, don't ask for help on it!||||


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •