js 输入框只能输入11位数字
文本框:
<input type="text" size="30" id="orderPersonTel" class="ma_input" maxlength="18" onkeyup="chekNum(this)"/>
//输入11位数字验证函数
function chekNum(obj){
obj.value = obj.value.replace(/[^\d.]/g,"");
obj.value = obj.value.replace(/^\./g,"");
obj.value = obj.value.replace(/\.{2,}/g,".");
obj.value = obj.value.replace(".","$#$").replace(/\./g,"").replace("$#$",".");
if(obj.value.length > 11){
obj.value = obj.value.substring(0,11);
}
}