单击后如何禁用按钮 [英] how to disable button after click

查看:69
本文介绍了单击后如何禁用按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,



如何在首次点击后禁用提交按钮。我使用下面的代码。如果没有Asp.net验证器,它可以正常工作。如果任何条目也与验证不匹配,则提交按钮将不可见。我只想在所有验证后使按钮不可见...



 btnSubmit.Attributes.Add(onclick,this.style .display ='none';); 



提前致谢

解决方案

 function onSubmit()
{
if(Page_Validate())
...或...
if(Page_Validate(Validation group name))
{

( #提交)隐藏();
}
}


 if(!Page.IsPostBack)
{

btnSubmit.Attributes.Add(onclick,javascript:if(Page_ClientValidate()){+ btnSubmit.ClientID +。disabled = true;}+ ClientScript.GetPostBackEventReference(btnSubmit,));
}


Hi there,

How can I disable Submit button after first click. I used the below code. It works fine if there is no Asp.net validators. If any entry doesn't match the validation too, the Submit button goes invisible. I just want to make the button invisible after all validations...

btnSubmit.Attributes.Add("onclick", "this.style.display='none';");


Thanks in advance

解决方案

function onSubmit()
{
   if(Page_Validate())
   ...or...
   if(Page_Validate("Validation group name"))
   {


("#submit").hide(); } }


if (!Page.IsPostBack)
{

 btnSubmit.Attributes.Add("onclick", "javascript: if (Page_ClientValidate() ){" + btnSubmit.ClientID + ".disabled=true;}" + ClientScript.GetPostBackEventReference(btnSubmit, ""));
}


这篇关于单击后如何禁用按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆