Results 1 to 6 of 6

Thread: Warning on load?

  1. #1
    Join Date
    Jul 2005
    Location
    SC
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Warning on load?

    Hello, i have some adult themes on one of my websites, and i wish to make a pop up box to have small children click out. The script I would like to use is:

    <script language="JavaScript">alert(" ")</script>

    But this script does not give the option of yes or no. How would I make the script for yes or no and start at the load of the screen? Thank you if you know how to do this and help me.

  2. #2
    Join Date
    Dec 2004
    Posts
    157
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Code:
    <html>
    <head>
    <script type="text/javascript">
    function disp_confirm()
    {
    var name=confirm("Press a button")
    if (name==true)
    {
    document.write("You pressed the OK button!")
    }
    else
    {
    document.write("You pressed the Cancel button!")
    }
    }
    </script>
    </head>
    
    <body>
    <form>
    <input type="button" onclick="disp_confirm()" value="Display a confirm box">
    </form>
    </body>
    
    </html>
    just change the document.write(you pressed "this" button!)

  3. #3
    Join Date
    Jul 2005
    Location
    SC
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thank you, i'm going to try it out now

  4. #4
    Join Date
    Jul 2005
    Location
    SC
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Ok tried it, What i want is when you first load. The box appears before anything on the website appears. The box should have a yes or no with the message "Are you over the age of 18?" If they click yes, it procceds and if they click no, it goes to yahoo or something like that. But Thanks anyways for your help.

  5. #5
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Still not precisely what you asked for but, should do:

    Code:
    <html>
    <head>
    <script type="text/javascript">
    var name=confirm("I certify that I am over the age of 18.\nClick OK to confirm, otherwise click cancel, you know who you are . . ." )
    if (!name)
    location.href="http://www.yahoo.com"
    else
    onload=function(){document.body.style.display='block'}
    </script>
    </head>
    
    <body style="display:none">
    Racy content goes here.
    </body>
    
    </html>
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  6. #6
    Join Date
    Jul 2005
    Location
    SC
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks that is perfect! I have been tring to get that code for a while now, but havn't be able to fingure it out. Now to study it and figure out how you did it. I'm rather new when it comes to websites and stuff, so thanks.

Bookmarks

Posting Permissions

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