开发者

Confirm button extender if textbox is empty

I want confirm button extender to pop up when Particular TextBox is empty. How to do tha开发者_运维知识库t? Thanks in advance. Any help would be appreciated.


Here is a simple way

<script>    
function CheckEmptyBox()
{
    var TextBox = document.getElementById("<%=TextBox1.ClientID%>");

    if("" == TextBox.value)
    {
        return confirm("text box is empty - ok to continue ?");
    }
    else
    {
        return true;
    }
}
</script>

and

<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" OnClientClick="return CheckEmptyBox();" />
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜