Modify code for javascript from php
<p>I am using a series of check boxes all are with different name that is checkbox1....checkbox40. I am generating a series of sting with '1' and '0' that is if check box is checked than sting will be concatenated with '1' else it will be concatenated with '0'. I have successfully implemented idea for PHP but as now I am using Ajax I want to develop same code for java script. My PHP code for that is</p>

<pre><code>if (isset($_POST[submit]))
{
for ($i=1; $i&lt;41; $i++)
    {
    $walue = "restriction".$i;
    if(isset($_POST[$walue])) {$val .="1";} else {$val .="0";}
    }
}
echo "Equivalent String: ".$val."&lt;p&gt;";
</code></pre>

<p>for implementing it using Javascript I have called a function on submit event of form. </p>

<p>My form id is <code>theForm</code> and my checkboxes name is <code>restriction1....restriction40</code>. Please give me hint to implement the idea.</p>
