I need to validate a checkbox
<p>this is my code:</p>

<pre><code>&lt;script&gt;                        
function validate(form) {   
    fail = validate_department(form);
    if (fail == "") { 
        return true;
        } else { 
            alert(fail);
            return false;
        }
    }
&lt;/script&gt;
&lt;script&gt; 
    function validate_department(form) {
        if(!(form.operations.checked == true) &amp;&amp; !(form.marketing.checked == true) &amp;&amp; !(form.training.checked == true)){ return "You must enter at least one of the following: marketing, training, or operations.\n"; 
        }
        return "";
    }   

&lt;/script&gt;
&lt;form method="post" action="checkbox.php" onSubmit="return validate(this)"&gt;
&lt;input type="checkbox" name="operations" value="operations" /&gt; Operations &lt;br&gt;
                        &lt;input type="checkbox" name="marketing" value="marketing" /&gt; Marketing &lt;br&gt;
                        &lt;input type="checkbox" name="training" value="training" /&gt; Training
&lt;input id="submit" type="submit" name="submit" value="Signup" /&gt;                        
&lt;/form&gt;
</code></pre>

<p>If I don't check anything I want to get a message telling me that I must check at least one.                       </p>
