title: Passing the parent form on the onclick event to javascript function
body: <p>I am trying to pass variables on the <code>onclick</code> event to a Javascript function. I am trying the following way, I can't get the input value in the Javascript function. (I am expecting an alert of 1.) Is it the right way of doing this? Please help.</p>
  
  <pre><code>&lt;html&gt;
  
      &lt;head&gt;
          &lt;script&gt;
              function submit_value(form) {
                  alert(form.ip.value);
              }
          &lt;/script&gt;
      &lt;/head&gt;
      &lt;table&gt;
          &lt;tr&gt;
              &lt;form&gt;
                  &lt;td&gt;
                      &lt;input id="ip" type="text" value="1"&gt;
                  &lt;/td&gt;
                  &lt;td&gt;
                      &lt;a href="javascript:;" onClick="submit_value(this)"&gt;Button&lt;/a&gt;
                  &lt;/td&gt;
              &lt;/form&gt;
          &lt;/tr&gt;
      &lt;/table&gt;
  
  &lt;/html&gt;
  </code></pre>