Can enter the digital page special effects code, can effectively limit the user input data before can only enter the number.
<!doctype HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd" >
<html xmlns= "http://www.jzread.com/1999/xhtml" >
<head>
<meta http-equiv= "Content-type" content= "HTML; charset=gb2312 "/>
<title>js can only enter digital code </title>
<script>
function Check ()
{
if (!isnan (Myform.str.value))
{
Alert ("number");
}
}
</script>
</head>
<body>
Only numbers can be entered with regular expression restrictions:
<form name= "MyForm" >
<input name= "str" onkeyup= "Value=value.replace (/[^d]/g,"); "onbeforepaste=" Clipboarddata.setdata (' text ', Clipboarddata.getdata (' text '). Replace (/[^d]/g, ') "/>
<input name= "type=" button "onclick=" Check (); " Value= "Verify all Numbers"/>
</form>
</body>
</html>