日期:2014-05-16 浏览次数:20385 次
var ipAddress = document.getElementById("form:ipAddress").value; var re = /^([0-9]|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.([0-9]|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.([0-9]|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.([0-9]|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])$/; if(!re.test(ipAddress)){ alert("ip地址格式不正确,请修改"); return false; }
onkeypress="return checkIsNumber();" function checkIsNumber(){ if(event.keyCode>=48&&event.keyCode<=57){ return true; }else{ alert("只能输入数字"); return false; } }