简体   繁体   中英

How can i call two javascript function from c# page both on button click

 btnSubmit.OnClientClick = "return Getprodsize('" + hdnprdsize.ClientID + "')";
 btnSubmit.OnClientClick = "return formatSpecifications('" + hdnSpecifications.ClientID + "')";

Only one function is called it ignores the other i need both the functions to be called on button click.

please help me

How about add a middle function to wrap both functions up?

 function MiddleWare(hdnprdsizeClientID, hdnSpecificationsClientID){ Getprodsize(hdnprdsizeClientID); formatSpecifications(hdnSpecificationsClientID); } 
 btnSubmit.OnClientClick = "return MiddleWare('" + hdnprdsize.ClientID +",'" + hdnSpecifications.ClientID + "')"; 

如果您不执行任何操作,则返回值:

btnSubmit.OnClientClick = "function () { Getprodsize('" + hdnprdsize.ClientID + "');formatSpecifications('" + hdnSpecifications.ClientID + "');return true; }";
   btnSubmit.OnClientClick = "Getprodsize('" + hdnprdsize.ClientID + "');return formatSpecifications('" + hdnSpecifications.ClientID + "')";

为了确保两个函数都被调用..丢弃第一个函数返回检查

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM