if(document.form1.text1.value="")
  return false;
else
  check();//验证的方法

解决方案 »

  1.   

    我觉得楼上的有点问题哦。应该是这样的吧:
    function check( form1 ){
       
       if( form1.mailtext.value.length != 0 ){ //Email栏填东西了
         
         //在这里写检查Email格式的方法
         
       }else if(......//检查其它的省略 ){
         ...
       } else {
         return true ;
       }}
      

  2.   

    <form name = form1 action = "aa.asp" method = post>
    <input type = text name = email>
    <input type = button name = bu value = Submit>
    </form>
    <script>
    function document.all.bu.onclick()
    {
      window.execScript("mail = trim(form1.email.value)","VBscript");
      if (mail!="")    
      {
        if (mail.indexOf("@") == -1 || mail.indexOf(".") == -1|| mail.indexOf(" ")!= -1)
        {
          alert("不是一个 合法的 E-mail");
          return false;
        }
      }
      form1.submit();
    }
    </script>
      

  3.   

    function IsValidEmail(email)
    IsValidEmail = true
    names = Split(email, "@")
    if UBound(names) <> 1 then
       IsValidEmail = false
       exit function
    end if
    for each name in names
       if Len(name) <= 0 then
         IsValidEmail = false
         exit function
       end if
       for i = 1 to Len(name)
         c = Lcase(Mid(name, i, 1))
         if InStr("abcdefghijklmnopqrstuvwxyz_-.", c) <= 0 and not IsNumeric(c) then
           IsValidEmail = false
           exit function
         end if
       next
       if Left(name, 1) = "." or Right(name, 1) = "." then
          IsValidEmail = false
          exit function
       end if
    next
    if InStr(names(1), ".") <= 0 then
       IsValidEmail = false
       exit function
    end if
    i = Len(names(1)) - InStrRev(names(1), ".")
    if i <> 2 and i <> 3 then
       IsValidEmail = false
       exit function
    end if
    if InStr(email, "..") > 0 then
       IsValidEmail = false
    end ifend function
      

  4.   

    if(! /^[a-zA-Z0-9_\-]{1,}@[a-zA-Z0-9_\-]{1,}\.[a-zA-Z0-9_\-.]{1,}$/.test(email_string) ) alert("Email error");