Thứ Tư, 19 tháng 11, 2008

Input Numberic in TextBox

Declare code in script and using it like

<HTML>

<HEAD>
<SCRIPT language=Javascript>

function isNumberKey(evt)
{

var charCode = (evt.which) ? evt.which : event.keyCode
if (charCode > 31 && (charCode <> 57))
return false;
return true;
}
SCRIPT>
HEAD>
<BODY>
<INPUT id="txtChar" onkeypress="return isNumberKey(event)" type="text" name="txtChar">
BODY>
HTML>

we can use it in asp.net using
onkeypress="return isNumberKey(event)" in textbox event

heeeeeeee!!!!!!!!!!



Không có nhận xét nào: