title: Javascript function call on form submit
body: <pre><code>    function next()
      {
      alert("form submited");
      return true;
  
      }
  
  &lt;form onsubmit="return next()" action="add.php" method="post" id="p1"&gt;
      &lt;center&gt;Add New Survey&lt;/center&gt;
       &lt;p&gt;&amp;nbsp;&lt;/p&gt;
      &lt;p align="left"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Title:    &lt;/p&gt;
      &lt;textarea name="title" cols="2" class="inputs" id="title"&gt;&lt;/textarea&gt;
      &lt;p align="left"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Discription: (Optional)    &lt;/p&gt;
      &lt;textarea name="dis" cols="2" class="inputs" id="dis"&gt;&lt;/textarea&gt;
       &lt;p align="left"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Number of questions:    &lt;/p&gt;
  
      &lt;select class="inputs" id="options" onchange="run()" name="options"&gt;
      &lt;option value="1" &gt;1&lt;/option&gt;
      &lt;option value="2" &gt;2&lt;/option&gt;
      &lt;option value="3" &gt;3&lt;/option&gt;
      &lt;option value="4" &gt;4&lt;/option&gt;
      &lt;option value="5" &gt;5&lt;/option&gt;
      &lt;/select&gt;
      &lt;br /&gt;
  
            &lt;input type="Submit" value="Next" class="button" name="next"/&gt;
        &lt;/p&gt;
    &lt;/form&gt;
  </code></pre>
  
  <p>Here is my code, i want to alert "form submitted" through JavaScript function. when i submit the form, nothing happen. i should alert the string.</p>