function check_ip(ip){
if(ip!="")
{
var reg=/^(([01]?[\d]{1,2})|(2[0-4][\d])|(25[0-5]))(\.(([01]?[\d]{1,2})|(2[0-4][\d])|(25[0-5]))){3}$/ 
if(!reg.test(ip)){ 
alert("格式错误!请重新输入"); 
document.getElementById('ip').focus() 
}

}