title: uncheck one checkbox as another is checked and submit the form
body: <p>I am trying to combine two <code>javascript</code> functions into one function.</p>
  
  <p>So, I have this chunk of code:</p>
  
  <pre><code>&lt;form name="form1" action="testing_page2.php" method="GET"&gt;
  &lt;p&gt;&lt;input id="Main" type="checkbox" name="Main" value="1" onClick="javascript:uncheckSecondary(this);" /&gt;Main&lt;/p&gt;
  &lt;p&gt;&lt;input id="Secondary" type="checkbox" name="Secondary" value="2" /&gt;Secondary&lt;/p&gt;
  &lt;/form&gt;
  
  &lt;script language="javascript" type="text/javascript"&gt;
  function uncheckSecondary(obj)
          {
              if (obj.checked == true)
              {
                  document.getElementById("Secondary").checked = false;
              }
          }
  &lt;/script&gt;
  </code></pre>
  
  <p>Here, when the page loads, the <strong>Secondary</strong> checkbox will be <strong>checked</strong> (I have an <code>if clause</code> there, but it is not related to my question) , but <strong>Main</strong> is not checked.
  As I check the <strong>Main</strong> checkbox, <strong>Secondary</strong> is <strong>unchecked</strong>.</p>
  
  <p>And also I have another piece of code:</p>
  
  <pre><code>&lt;script language="javascript"&gt;
  function checkRefresh(value)
  {
      document.form1.submit();
  }
  &lt;/script&gt;
  &lt;form name="form1" action="testing_page2.php" method="GET"&gt;
      &lt;p&gt;&lt;input id="Main" type="checkbox" name="Main"  value="1" onClick="this.form.submit();"/&gt;Main&lt;/p&gt; 
      &lt;p&gt;&lt;input id="Secondary" type="checkbox" name="Secondary" value="2"  onClick="this.form.submit();"/&gt;Secondary&lt;/p&gt;
  
  &lt;/form&gt;
  </code></pre>
  
  <p>Here, as I check/uncheck any of checkboxes, the form is submitted.</p>
  
  <p>Edited:</p>
  
  <p>What I want is to combine <code>function checkRefresh(value)</code> and <code>function uncheckSecondary(obj)</code> , so that when I check Main, the Secondary is unchecked and form is submitted, and <strong>vice versa</strong>.</p>