<html>
<head>
<script language=javascript >
function Chk(){
var r1;
var sValue;
sValue=document.syFrm.txtRegSy.value;
r1=/[^\d]/;
alert(sValue);
if (r1.test(sValue))
alert('非法字符,只能输入数字!!!');
else
alert('全是数字,可以通过!!!');
return false;
}
</script><h3 align=center >输入一个字符串后回车</h3>
</head>
<body align=center>
<form name="syFrm" action=# onsubmit="return Chk();" >
<input type=text name="txtRegSy" >
<input type=button id=syRa name=syRa checked onclick="return Chk();" value="SYREG">
</form>
</body>
</html>
<head>
<script language=javascript >
function Chk(){
var r1;
var sValue;
sValue=document.syFrm.txtRegSy.value;
r1=/[^\d]/;
alert(sValue);
if (r1.test(sValue))
alert('非法字符,只能输入数字!!!');
else
alert('全是数字,可以通过!!!');
return false;
}
</script><h3 align=center >输入一个字符串后回车</h3>
</head>
<body align=center>
<form name="syFrm" action=# onsubmit="return Chk();" >
<input type=text name="txtRegSy" >
<input type=button id=syRa name=syRa checked onclick="return Chk();" value="SYREG">
</form>
</body>
</html>
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货