Forum Moderators: open
This is an age verification script. It works using alerts. I basically want t oknow how to alter it so that once the correct age is typed in, it will just go straight to the homepage and not bring up a welcome alert. Any help appreciated.
I have already been given an answer...but it never worked. Try it to see how it works.
<script language="javascript">
var agePrompt=prompt("You must be over 18 to enter.")
if (agePrompt>=18) alert('welcome to ....')
else {
alert('Sorry, we can not let you in!')
document.location="http://www.example.co.uk";
}
</script>
Regards
webboy
<script language="javascript">
var agePrompt=prompt("You must be over 18 to enter.")
if (agePrompt>=18)
document.location="http://www.example.co.uk/ok-page.html";
else {
alert('Sorry, we can not let you in!')
document.location="http://www.example.co.uk/too-young-page.html";
}
</script>
This should send a person to 'ok-page.html' if they are 18 or over, but to too-young-page.html' if they are too young.
I'm no good at cookies on Unix servers but fine on IIS/ASP pages. I'm sure someone here will be able to to help you out with it though if you're on a Unix host.