1. function checkdata() { 
  2.  
  3. var email = document.getElementById("email").value; 
  4.  
  5. if (document.form1.username.value=="") { 
  6. window.alert ("用户名不能为空"
  7. document.form1.action="login.jsp" 
  8. if (document.form1.useremail.value=="") { 
  9. window.alert ("邮箱不能为空"
  10. document.form1.action="login.jsp" 
  11. if (email !=""&&email.search(/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/ ) == -1){  
  12.       alert("邮箱格式不正确!请重新输入"); 
  13. document.form1.action="login.jsp"  
  14.     }