TextBox Empty validation using Javascript

hi,
[code]
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Button1.Attributes.Add("onclick", "TextboxEmptyValidation();")
End Sub
[/code]
[code]
<script type ="text/javascript" >
function TextboxEmptyValidation()
{
var empty=document.getElementById("Text1").value;
if (empty=="")
{
alert("Textbox is Empty");
}
}
[/code]
[code]
<asp:Button ID="Button1" runat="server" Text="Button" />
[/code]

No comments:

Post a Comment

Plz Share your comments...