javascript小玩意,只让输入数字的输入框
<body>
<script>
function JHshNumberText()
{
if ( !(((window.event.keyCode >= 48) && (window.event.keyCode <= 57))
|| (window.event.keyCode == 13) || (window.event.keyCode == 46)
|| (window.event.keyCode == 45)))
{
window.event.keyCode = 0 ;
}
}
</s cript>
<form name=frm>
<input type=text name=test value="" onKeypress="JHshNumberText()">
<input type=button name=submit value=submit>
</form>
</body>