How to Create a Multiple Submit Buttons action using JavaScript and Html:






    <SCRIPT>
    function OnSubmitForm()
    {
      if(document.pressed == 'Insert')
      {
       document.myform.action ="index.jsp";
      }
      else
      if(document.pressed == 'Update')
      {
        document.myform.action ="update.jsp";
      }
      else
          if(document.pressed=='Delete'){
               document.myform.action ="delete.jsp";
          }
         
      return true;
    }
    </SCRIPT>
    
    
   <FORM name="myform" onSubmit="return OnSubmitForm();">
    
    <INPUT TYPE="SUBMIT" name="operation" onClick="document.pressed=this.value"    VALUE="Insert">
    
    <INPUT TYPE="SUBMIT" name="operation" onClick="document.pressed=this.value" VALUE="Update">

    <INPUT TYPE="SUBMIT" name="operation" onClick="document.pressed=this.value" VALUE="Delete">
    </FORM>



0 comments:

Post a Comment