if(form1.Para.value==""){alert("不能为空");}

解决方案 »

  1.   

    <html>
    <head>
    <script>
     function test()
     {
    var reg= /\S/;
    var v=t.value;
    if(v.match(reg)) alert("不为空");
    else alert("为空");
     }
    </script>
    <body>
    <button onclick="test()">button</button>
    <input id=t type=text>
    </body>
    </html>
      

  2.   

    <html>
    <head>
    <script>
     function test()
     {
    var reg= /\S/;
    var v=t.value;
    if(v.match(reg)) alert("不为空");
    else alert("为空");
     }
    </script>
    <body>
    <button onclick="test()">button</button>
    <input id=t type=text>
    </body>
    </html>
      

  3.   

    <script language='javascript'>
    function validat()
    {
        if(form1.Para.value=="")
        {
            alert("内容不能为空");
            return false;
        }
        return true;
    }</script>
    <form name=form1 method="post" onsubmit="return validate()">
    <input type=text name=Para>
    <input type=submit name=sub value="submit">
    </form>