title: why this Javascript function doesn't work?
body: <p>I use the following javascript function,</p>
  
  <pre><code>function get_check_value(formId,checkboxId,TxtboxId)
  {
  alert(formId);
  
  var c_value = "";
  for (var i=0; i &lt; document.formId.checkboxId.length; i++)
     {
     if (document.formId.checkboxId[i].checked)
        {
        c_value = c_value + document.formId.checkboxId[i].value + "\n";
        }
     }
     alert(c_value);
     document.getElementById(TxtboxId).value= c_value;
    // alert(c_value.value);
  </code></pre>
  
  <p>}</p>
  
  <p>and my php page has this,</p>
  
  <pre><code>&lt;form name="orderform" id="orderform"&gt;
  &lt;input type="text" name="chId" id="chId" &gt;
      &lt;table align="center" border="0"&gt;
          &lt;tr&gt;
              &lt;td&gt;Country&lt;/td&gt;
          &lt;/tr&gt;
      &lt;? foreach($country as $row){   ?&gt;
      &lt;tr&gt;
      &lt;td&gt;&lt;?= $row['dbCountry']; ?&gt;&lt;/td&gt;
      &lt;td&gt;&lt;input type="checkbox" name="CountrycheckId" id="CountrycheckId" value="&lt;?= $row['dbCountryId']; ?&gt; " onClick="get_check_value('orderform','CountrycheckId','chId')"&gt;&lt;/td&gt;  
      &lt;? }  ?&gt;
      &lt;/tr&gt;
      &lt;/table&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>I am getting formname,checkboxid,textid in alerts inside the javascript function... But
  the problem is with the line 
  <code>for (var i=0; i &lt; document.formId.checkboxId.length; i++)</code></p>
  
  <p>Webdeveloper toolbar shows this error</p>
  
  <p><code>document.formId is undefined</code></p>