一:表单数字范围验证:
<table style="width: 85%; margin: 0px auto; border: 1px solid #a3c0e8; border-top-width: 0px;
border-bottom-width: 0px;" cellpadding="0" cellspacing="0">
<tr>
<td style="width: 50%; border-right-width: 0px;" class="tdbg">
<span class="LabelStyle">纬度:
<asp:TextBox ID="Y_Du" runat="server" Width="20%" CssClass="txtBox" onkeyup="javascript:this.value=this.value.replace(/[^\d]/g,‘‘);if(this.value<0){this.value=0;};if(this.value>360){this.value=360;}"></asp:TextBox> 度
<asp:TextBox ID="Y_Fen" runat="server" Width="20%" CssClass="txtBox" onblur="check_num_value(‘当前验证字段经纬度‘,this,0,60)"></asp:TextBox> 分
<asp:TextBox ID="Y_Miao" runat="server" Width="20%" CssClass="txtBox" onblur="check_num_value(‘当前验证字段经纬度‘,this,0,60)"
></asp:TextBox> 秒</span>
</td>
<script type="text/javascript">
function check_num_value(obj_name,obj,minvalue,maxvalue){
var reg = /^[0-9]+$/;
if(obj.value!=""&&!reg.test(obj.value)){
alert(obj_name+‘只能输入数字!‘);
obj.value = "";
obj.focus();
return false;
}else if(minvalue>obj.value||obj.value>maxvalue){
alert(obj_name+"的范围是"+minvalue+"-"+maxvalue+"!");
obj.value="";
obj.focus();
return false;
}
}
</script>
</tr>
</table>