Thread: JavaScript help
View Single Post
Author Message
Rirre
Veteran Member
Join Date: Nov 2006
Old 12-17-2010 , 10:46   JavaScript help
Reply With Quote #1

In need of help with JavaScript.
I'm trying to make a checkbox with a submit button which you have to check to redirect/continue to the 'newpage.php' file.

You don't get redirected to 'newpage.php' when you check the checkbox and submit. It just refresh the current page you are on.
PHP Code:
<html>
<
head>
<
script language=javascript>
function 
validate(chk){
  if (
chk.checked == 1)
    
window.location='newpage.php';
  else
    
alert('You have not agreed!')
}
</script>
</head>

<body>
    <form>
        <input type='checkbox' name='chk1' /> Agree<br />
        <input type='image' src='images/continue.jpg' align='right' onclick='return validate(chk1);' />
    </form>
</body>
</html> 
Appreciate all help.

Last edited by Rirre; 12-17-2010 at 10:57.
Rirre is offline