title: Clear all textfields inside a DIV with javascript only
body: <p>I want to clear the contents of all text fields inside a given DIV with a button. I am using this javascript code:</p>
  
  <pre><code>&lt;div id="block1"&gt;
      &lt;table&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;!--somefields--&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;input type="button" onclick="clear('block1')" value="clear"&gt;&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/table&gt;
  &lt;/div&gt;
  &lt;script type="text/javascript"&gt;
      function clear(fieldid) {
          document.getElementById(fieldid).childNodes[3].innerHTML='';
      }
  &lt;/script&gt; 
  </code></pre>
  
  <p>but its not working. What is wrong? </p>
  
  <p>Thank you.</p>