javascript for numbers validation in textbox function clickButton(e){
if(navigator.appName.indexOf("Netscape")>(-1)){ if (e.keyCode == 13){ bt.click(); return false; } } if (navigator.appName.indexOf("Microsoft Internet Explorer")>(-1)){ if (event.keyCode < 48 || event.keyCode > 57){ //bt.click(); alert("Enter Numbers Only"); return false; } if(event.Length>3) { alert("Number Should be between 1 and 999") } }
}
And Then Go to CodeBehind File and then add the Below Procedure. Public Sub numbers(ByVal txtbox As System.Web.UI.WebControls.TextBox) txtbox.Attributes.Add("onkeypress", "return clickButton(event)") End Sub
1 comment:
javascript for numbers validation in textbox
function clickButton(e){
if(navigator.appName.indexOf("Netscape")>(-1)){
if (e.keyCode == 13){
bt.click();
return false;
}
}
if (navigator.appName.indexOf("Microsoft Internet Explorer")>(-1)){
if (event.keyCode < 48 || event.keyCode > 57){
//bt.click();
alert("Enter Numbers Only");
return false;
}
if(event.Length>3)
{
alert("Number Should be between 1 and 999")
}
}
}
And Then Go to CodeBehind File and then add the Below Procedure.
Public Sub numbers(ByVal txtbox As System.Web.UI.WebControls.TextBox)
txtbox.Attributes.Add("onkeypress", "return clickButton(event)")
End Sub
Post a Comment