就像这样的验证 ,谢谢了  给个列子 就行 

解决方案 »

  1.   

    if($(#"emailid").val()="")alert('请输入你的Email地址')if($(#"nameid").val()="")alert('请输入用户名')
      

  2.   

    粗略的写了个简单的例子 将就着看吧
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>简单例子</title>
    <style type="text/css">
    *{padding:0; margin:0; font-size:12px;}
    #tips{color:red;}
    #input1{border:1px solid #ccc;}
    #submit1{width:40px; height:18px; line-height:18px; border:1px solid #ccc;}
    </style>
    <script>
    function checkFrm(){
    var aa=document.form1.email.value
    if (aa==""){
    document.getElementById('tips').innerHTML="请填写邮箱";
    return false;
    }
    }
    </script>
    </head>
    <body>
    <form name="form1" method="post" action="" onsubmit="return checkFrm()">
    邮箱:<input type="text" id="input1" name="email"><span id="tips"></span><br />
    <input type="submit" id="submit1" value="提交">
    </form>
    </body>
      

  3.   

    这个可以用ajax 向后台请求,然后后台判断输入是否正确,然后返回到前台。

    document.getElementById('tips').innerHTML="";
      

  4.   

    document.getElementById('msg').innerHTML="<img src='tips.gif'/><font color='red'>请填写邮箱</font>";
    当合法的时候,即验证通过的时候document.getElementById('msg').innerHTML = "";即可
    <div id="msg"></div>
      

  5.   


    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>例子</title>
    <script>
    function checkForm(){
        var e=document.form1.email.value;
        if (e==""){
          alert("请输入email");
          return
        }
        var name=document.form1.name.value;
        if(name==""){
          alert(请输入用户名);
          return;
        }
    }
    </script>
    </head>
    <body>
    <form name="form1" method="post" action="">
    Email:<input type="text" id="email" name="email"><br/>
    用户名:<input type="text" id="name" name="name">
    <input type="button" id="tj" value="提交" onclick="checkForm();">
    </form>
    </body>