判断输入为数字
<tr>
<td> 部门: </td>
<td colspan= "3 ">
<input type= "checkbox " name= "codepts <%=i+1%> " value= " <%=TSysDept.getDeptid()%> ">
<input name= "copercent_ <%=TSysDept.getDeptid() %> " class= "in " size= "5 " value= " " onpropertychange= "sumNum(this) ">
<input type= "hidden " name= "porderd_ <%=TSysDept.getDeptid() %> " value= " <%=porderd %> ">
</td>
</tr>
怎样判断输入为数字
onpropertychange= "sumNum(this) 这个脚本应该怎么实现?
------解决方案--------------------function sumNum(obj)
{
var num=obj.value;
if(!num.match(/^[1-9](\d*)?(\.[\d]+)?$/))
{
event.keyCode=0;
event.returnValue=0;
}
}