Forum Moderators: open
Here is the script:
<script type="text/javascript">
function Check() {
if(document.story.eighteen.checked == false)
{ alert('Please check the box if you are 18 or over.'); }
if(document.story.permission.checked == false)
{ alert('Please check the box to give us permission to reprint.'); }
}
</script>
Here is the form:
<form name="story" method="POST" action="/ad/submitfantasy/contact.asp">
<table width="35%"><tr><td width="25%">
<p><font face="arial black" color="#c11b17"><b><i>I am a man:</i></b></font><br>
<input type="checkbox" name="Iamaman" value="Yes">
</td><td width="25%"><font face="arial black" color="#c11b17"><b><i>I am a woman:</i></b></font><br>
<input type="checkbox" name="Iamawoman" value="Yes"></td></tr>
</table>
<font face="arial black" color="#c11b17"><b><i>I am 18 or over:</i></b></font><br>
<input type="checkbox" name="eighteen" value="Yes">
<p><font face="arial black" color="#c11b17"><b><i>May we have permission to publish this fantasy?</i></b></font><br>
<input type="checkbox" name="permission" value="Yes">
<p><font face="arial black" color="#c11b17"><b><i>My Fantasy:</i></b></font><br>
<textarea name="MyFantasy" rows="25" cols="100"></textarea>
<p><input type="submit" name="submit" value="Submit" onclick="Check()">
</form>
I tried putting this at the end of the script, but it didn't work. Instead it would just refresh the page, no alert boxes, no action.
if(document.story.eighteen.checked == true) && (document.story.permission.checked == true) {
document.story.action = '/ad/submitfantasy/contact.asp'; }
<script type="text/javascript">
function Check() {
if(document.story.eighteen.checked == false) {
alert('Please check the box if you are 18 or over.');
[b]return false;[/b]
}
if(document.story.permission.checked == false) {
alert('Please check the box to give us permission to reprint.');
[b]return false;[/b]
}
}
</script>
<form name="story" method="POST" action="/ad/submitfantasy/contact.asp" [b]onsubmit="return Check();"[/b]>
...
<input type="submit" name="submit" value="Submit">
</form>
[edited by: Fotiman at 6:32 pm (utc) on Aug. 10, 2007]