复制代码 代码如下:
<script language="javascript" type="text/javascript">
function onlyNum()
{
if(!(event.keyCode==46)&&!(event.keyCode==8)&&!(event.keyCode==37)&&!(event.keyCode==39)&&!(event.keyCode==190))
if(!((event.keyCode>=48&&event.keyCode<=57)||(event.keyCode>=96&&event.keyCode<=105)))
event.returnValue=false; //不让非数字显示
}
</script>
<asp:TextBox ID="TextBox1" runat="server" onkeydown="onlyNum();" style="ime-mode:Disabled"></asp:TextBox><br />
附JavaScript键码值表
时间: 2024-12-23 22:41:49