jamescover
06-22-2004, 05:40 AM
Hi:
Here's the script:
<script>
<!--
function checkForm(){
if (document.myForm.cbox.checked){
window.top.location.href="http://yourDomain.com/yourPage.php";
}else{
alert('You Must Agree To The Terms To Continue');
}
}
//-->
</script>
Here's the form:
<form name=myForm onsubmit=checkForm() method=post>
<input type=checkbox name=cbox checked>
<input type=submit value=Agree>
</form>
Does anyone know why the first statement (window.top.location.href="http://yourDomain.com/yourPage.php" ; ) won't execute?
If I alert the conditional (alert (document.myForm.cbox.checked) ), it comes back true.
If I call the script from an anchor tag (<a href=javascript:checkForm()>Check Form</a>) it executes.
If I use a method, like alert(), or open(), after the conditional, they execute.
???
Any ideas appreciated. Thanks!
-james
Here's the script:
<script>
<!--
function checkForm(){
if (document.myForm.cbox.checked){
window.top.location.href="http://yourDomain.com/yourPage.php";
}else{
alert('You Must Agree To The Terms To Continue');
}
}
//-->
</script>
Here's the form:
<form name=myForm onsubmit=checkForm() method=post>
<input type=checkbox name=cbox checked>
<input type=submit value=Agree>
</form>
Does anyone know why the first statement (window.top.location.href="http://yourDomain.com/yourPage.php" ; ) won't execute?
If I alert the conditional (alert (document.myForm.cbox.checked) ), it comes back true.
If I call the script from an anchor tag (<a href=javascript:checkForm()>Check Form</a>) it executes.
If I use a method, like alert(), or open(), after the conditional, they execute.
???
Any ideas appreciated. Thanks!
-james