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 9 of 9

Thread: Warning Window

  1. #1
    New Coder
    Join Date
    Oct 2003
    Posts
    26
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Warning Window

    I want to do a confirmation window when someone enters my site indicating that some material may not be appropriate for those under the age of 18. I tried using window.confirm but evidently there is a constraint on the length of the message I can put in there. If the visitor clicks ok, then I will direct them to the site, otherwise I want to send them back where they came from.

    Thanks

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Posts
    1,404
    Thanks
    2
    Thanked 32 Times in 32 Posts
    ....evidently there is a constraint...
    Hmm...what is it? How long is your disclaimer? This sort of thing requires a modal box for control and, unless you're restricted to IE, you'll probably need window.confirm(). I've had dialogs (usually stupidly conceived source code readouts) that were so gigantic I had to reboot to get rid of them.

  • #3
    New Coder
    Join Date
    Oct 2003
    Posts
    26
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I tried doing the window.confirm() method with something such as "WARNING ! Some material on this site may not be suitable for those under the age of 18. By entering the site you agree that you will not hold "blah, blah, blah" responsible for any damage be it physical or mental that you may incur".

    The thing wouldn't even pop up. Any ideas ?

    I guess what I would need is a window with Yes/No buttons and then get the data based on what was pressed. If Yes was pressed then redirect them to my site, otherwise send them back.

    Thanks

  • #4
    Senior Coder
    Join Date
    Jun 2002
    Posts
    1,404
    Thanks
    2
    Thanked 32 Times in 32 Posts
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" 
        "http://www.w3.org/TR/html4/loose.dtd">
    
    <html>
    <head>
    <title>untitled</title>
    <script type="text/javascript" language="javascript">
    
    var sMsg = 'WARNING ! Some material on this site may not be suitable for those under the age of 18.\n\nBy entering the site you agree that you will not hold\n\n\tMr. R. Carnes\n\nresponsible for any damage be it physical or mental that you may incur.';
    
    if (!confirm(sMsg))
    	self.location = 'javascript&#58;alert("cya")'; //set to redirect url
    
    </script>
    </head>
    <body>
    <h1>[content]</h1>
    </body>
    </html>
    The window approach sounds OK, too. Haven't had much experience with this. Might be some legal issues...

  • #5
    New Coder
    Join Date
    Oct 2003
    Posts
    26
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Ok, on the site there is a js menu that has a home button that goes back to index.htm, how would I (could I) stop the Warning from coming up if the visitor clicks the Home button ?

    Legal Issues ????
    Last edited by rcarnes; 10-28-2003 at 02:49 AM.

  • #6
    Senior Coder
    Join Date
    Jun 2002
    Posts
    1,404
    Thanks
    2
    Thanked 32 Times in 32 Posts
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" 
        "http://www.w3.org/TR/html4/loose.dtd">
    
    <html>
    <head>
    <title>untitled</title>
    <script type="text/javascript" language="javascript">
    
    var sMsg = 'WARNING ! Some material on this site may not be suitable for those under the age of 18.\n\nBy entering the site you agree that you will not hold\n\n\tMr. R. Carnes\n\nresponsible for any damage be it physical or mental that you may incur.';
    
    if (!/__DISCLAIMERDIALOG__/.test(self.name))
    	if (!confirm(sMsg))
    		self.location = 'http://www.codingforums.com'; //redirect
    	else self.name += '__DISCLAIMERDIALOG__';
    
    </script>
    </head>
    <body>
    <h1>[content]</h1>
    </body>
    </html>
    Legal issues....got me. Pretty 'litigious society' around here, so they say. I'd be surprised if there wasn't case law on the defendability of website disclaimers, based on their methodology. Sorry now I brought it up. Nice confirm() box, though!

  • #7
    New Coder
    Join Date
    Oct 2003
    Posts
    26
    Thanks
    0
    Thanked 0 Times in 0 Posts
    So if I am understanding this correctly, the first time through it is setting the DISCLAIMER variable and then the next time through since it's set then it won't pop the window up ?

    Sweet ! Thanks alot ! There is nothing really bad on the site, just some naked women, profanity, etc... It my sons band's website that I am trying to redo.

    Thanks for your help
    Last edited by rcarnes; 10-28-2003 at 03:40 AM.

  • #8
    Senior Coder
    Join Date
    Jun 2002
    Posts
    1,404
    Thanks
    2
    Thanked 32 Times in 32 Posts
    Got it. Not just a 'variable' - it's the actual name of the window. An ordinary variable wouldn't work, as these are destroyed when a new document (page) is loaded, otherwise chaos would ensue. Window.name is persistent, so as to allow HTML targeting (<a href="..." target="myWindow">).

    Hope 'Belligerent' Jay isn't related. Personally, I enjoy naked women, profanity, etc. (in that order).

  • #9
    Supreme Overlord Spookster's Avatar
    Join Date
    May 2002
    Location
    Marion, IA USA
    Posts
    6,278
    Thanks
    4
    Thanked 83 Times in 82 Posts
    http://www.codingforums.com/rules.htm

    Did we choose not to read these when we registered?
    Last edited by Spookster; 10-28-2003 at 04:54 AM.
    Spookster
    CodingForums Supreme Overlord
    All Hail Spookster


  •  

    Posting Permissions

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