...

View Full Version : Warning Window



rcarnes
10-28-2003, 02:37 AM
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

adios
10-28-2003, 03:00 AM
....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.

rcarnes
10-28-2003, 03:14 AM
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

adios
10-28-2003, 03:24 AM
<!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...

rcarnes
10-28-2003, 03:42 AM
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 ????

adios
10-28-2003, 04:31 AM
<!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!

rcarnes
10-28-2003, 04:37 AM
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 (http://www.highriskband.com) that I am trying to redo.

Thanks for your help

adios
10-28-2003, 04:52 AM
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.:D Personally, I enjoy naked women, profanity, etc. (in that order).

Spookster
10-28-2003, 05:52 AM
http://www.codingforums.com/rules.htm

Did we choose not to read these when we registered?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum