Popup upon not checking checkbox

i have a checkbox and a submit button, i need some code that will popup a window saying you have to select the check box before u can submit [if checkbox is not selected upon pressing of ‘send’ button]

i searched a few JS sites already, with no luck. And i’m no whiz at it. Can any of you help me out here?
Any help will be appreciated

asT.

Put this before your button somewhere:

<script language="JavaScript" type="text/JavaScript">
<!--
function checkthebox() {
  if (document.form1.checkbox.checked == false){
  alert('You Forgot To Click \\" I agree \\"');
  }
}
-->
</script>

Then heres the form code:


<form name="form1" method="post" action="">
  <p>
    <input type="checkbox" name="checkbox" value="checkbox">
    I agree </p>
  <p>
    <input type="submit" name="Button" value="Next" onclick="checkthebox()">
  </p>
</form>

I think that should do it. If you need help feel free to pm me.

thanks bro.

I think you would prefer this one. As the one above will send itself any way. Instead this will not send unless it is ticked


<script language="JavaScript" type="text/JavaScript">
<!--
function checkthebox()
{
  if (document.form1.checkbox.checked == true)
	{
	 document.form1.submit();
  }
	else
	{
	 alert('You Forgot To Click \\" I agree \\"');
	}
}
-->
</script>

<form name="form1" method="post" action="gffgj">
  <p>
    <input type="checkbox" name="checkbox" value="checkbox">
    I agree </p>
  <p>
    <input type="button" name="Button" value="Next" onclick="checkthebox()">
  </p>
</form>