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

问题描述

使用以下代码我无法在点击后禁用提交btn。



 <   head     runat   =  server >  
< title > Untitled Page < / title >
< script 类型 = text / javascript >
函数DisableButton(){
document.getElementById(<% = Button4.ClientID %> )。disabled = true;
}
window.onbeforeunload = DisableButton;
< / script >





 < asp:Button  ID =Button4runat =serverToolTip =Please  note   down  您的 成员  ID   for   future  reference
OnClick =Button4_Click
style =z-index:1; left: 185px; top: 2840px; position: absolute; height :30px;宽度:80px; font-size:large ForeColor =GreenText =提交/>



<   script     type   =  text / javascript    language   =  JavaScript >  
function DisableButton(){
document.getElementById(<% = Button4.ClientID %> )。disabled = true;
}
< / script >







此后添加[OnClientClick]属性来控制



< asp:Button ID =Button4runat =serverToolTip =请记下您的会员ID以备将来参考
OnClick =Button4_Click
style =z-index:1; left:185px; top:2840px; position:absolute; height:30px; width:80px; font-size:largeForeColor =Green
Text =SubmitOnClientClick =DisableButton();/>




Using the following codes I am unable to disable the 'Submit' btn after a click.

<head runat="server">
    <title>Untitled Page</title>
    <script type = "text/javascript">
        function DisableButton() {
            document.getElementById("<%=Button4.ClientID %>").disabled = true;
        }
        window.onbeforeunload = DisableButton;
</script>



<asp:Button ID="Button4" runat="server"  ToolTip="Please note down your member ID for future reference"
  OnClick="Button4_Click"
style="z-index: 1; left: 185px; top: 2840px; position: absolute;   height:30px; width:80px; font-size:large " ForeColor="Green" Text="Submit" />
解决方案




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

05-22 16:46