Sportica   Sportica

正则。IP验证

function checkIP()                                      //检查IP
{
var exp=/^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$/; 
	obj=document.getElementById("NTPaddress").value;
	var reg1 = obj.match(exp); 
	if(reg1==null){
			alert("NTP地址输入不合法!");
			return false;
	}else{
			//alert("修改成功!");
			setTimeSet();
			return true;
		}
}

  

posted @ 2011-12-02 12:54  qingjoin  阅读(399)  评论(1编辑  收藏  举报
  Sportica