Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

JavaScritp in Button Click

Status
Not open for further replies.

zircon06

Technical User
Jan 8, 2007
81
I need to call different javascript functions based on the conditions in submit button click.
if(balancedue == 0)
//call javascript function to confirm
else
//call another javacript function to confirm.
How can I call based on the conditions. In page_load event btnsubm.Attribute.Add can only be called once but how do I add conditions to call different function for different criteria.
Any help is greately appreciated.
 
Put a function on the onsubmit of the <form> tag.

Code:
<form id="blah" method="blah" [!]onsubmit="return yourFunction()"[/!]>

Within the function you make, do all you need to. If you return false, the form will NOT be submitted.

Code:
function yourFunction() {
   if (balancedue == 0) { 
      //Do what you need to  
   else {
      //Do what you need to
   }
}



[monkey][snake] <.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top