// 检测电子邮件格式是否正确
function checkEmail(email) {
  var re = /\w+@.+\.\w+/;
  if (re.test(email))
    return true;
  else
    return false;
} 
// 检测电话格式是否正确
function checkTel(tel) {
  var re = /\w+\-\w+/;
  if (re.test(tel))
    return true;
  else
    return false;
}
// 检测传真格式是否正确
function checkFax(fax) {
  var re = /\w+\-\w+/;
  if (re.test(fax))
    return true;
  else
    return false;
}

function check() { 
var account=document.getElementById("account").value
var password=document.getElementById("password").value
var password1=document.getElementById("password1").value
var username=document.getElementById("username").value 
var email=document.getElementById("email").value 
var tel=document.getElementById("tel").value 
var fax=document.getElementById("fax").value
var company=document.getElementById("company").value 
var address=document.getElementById("address").value 
var trade=document.getElementById("trade").value 
var regjm=document.getElementById("regjm").value 

if(account=="") 
{ 
alert("请输入会员登录名!"); 
document.getElementById("account").focus() 
return false; 
} 
if(account.length<3) 
{ 
alert("会员名为3-12个字符!"); 
document.getElementById("account").focus() 
return false; 
}
if(account.length>12) 
{ 
alert("会员名为3-12个字符!"); 
document.getElementById("account").focus() 
return false; 
}
if(password=="") 
{ 
alert("请输入密码!"); 
document.getElementById("password").focus() 
return false; 
}
if(password.length<6) 
{ 
alert("密码为6-20个字符!"); 
document.getElementById("password").focus() 
return false; 
}
if(password.length>20) 
{ 
alert("密码为6-20个字符!"); 
document.getElementById("password").focus() 
return false; 
}
if(password1=="") 
{ 
alert("请重复输入密码!"); 
document.getElementById("password1").focus() 
return false; 
}
if(password!=password1) 
{ 
alert("两次输入的密码必须相同!"); 
document.getElementById("password1").focus() 
return false; 
}  
if(username=="") 
{ 
alert("请输入联系人!"); 
document.getElementById("username").focus() 
return false; 
} 
if(!checkEmail(email))
{
alert("请正确输入您的电子邮件地址");
document.getElementById("email").focus() 
return false;
}
if(!checkTel(tel))
{
alert("请正确输入您的电话，格式：0592-2392333");
document.getElementById("tel").focus() 
return false;
}
if(!checkFax(fax))
{
alert("请正确输入您的传真，格式：0592-2396880");
document.getElementById("fax").focus() 
return false;
}

if(company=="") 
{ 
alert("请输入公司名称!"); 
document.getElementById("company").focus() 
return false; 
} 

if(address=="") 
{ 
alert("请输入公司地址!"); 
document.getElementById("address").focus() 
return false; 
} 
if(trade=="") 
{ 
alert("请输入所属行业!"); 
document.getElementById("trade").focus() 
return false; 
}
if(regjm=="") 
{ 
alert("请输入验证码!"); 
document.getElementById("regjm").focus() 
return false; 
}

} 

