<from name="form1" action="" method="post">
      您的大名:<INPUT type="text" name="name1">&nbsp;<font color="red">*</font><br>
         <input type="submit" value="确定" onClick="if (name1.value==''){ alert('请输入你的大名!');return false;}">
      <input type="reset" value="重填">
      </from>

解决方案 »

  1.   

    <input type="submit" value="确定" onSubmit="result();">
    应该这样写吧
      

  2.   

    不行啊 我改成onSubmit还是不行
    这是我的原程序<%@ page language="java" import="java.util.*" pageEncoding="GB2312"%><html>
      <head>
    <title>留言</title>
    <script language="javaScript">
    function result()
    {  
    if (document.form1.name1.value=="")
    {
    alert("请输入你的大名");
    }
    }
    </script>
      </head>
      
      <body>
         <center>
          <from name="form1" action="javascript:login()" method="post">
          您的大名:<INPUT type="text" name="name1">&nbsp;<font color="red">*</font><br>
          您的OICQ:<input type="text" name="qq"><br>
          您的邮箱:<input type="text" name="mail"><br>
          您的主页:<input type="text" name="page"><p>
          留言内容:<br><textarea name="content" cols=50 rows=6></textarea><br>
          <input type="submit" value="确定"  onSubmit="result();">
          <input type="reset" value="重填">
          </from>
         </center>
      </body>
    </html>
      

  3.   

    penglewen(昨日如梦) 方法可以,但要是单独做个javascript的函数怎么就不行呢
      

  4.   

    <input type="submit" value="确定" onClick="result();">
    改为
    <input type="submit" value="确定" onClick="return result();">result函数改为:
    function result()
    {  
                if (document.form1.name1.value=="")
       {
         alert("请输入你的大名");
                           return false;
        }
    }
      

  5.   

    function result()
    {  
      if (document.form1.name1.value=="")
      {
        alert("请输入你的大名");
        return false;
      }
      return ture;
    }
      

  6.   

    <html>
      <head>
    <script language="javaScript">
    function result()
    {  
                if (document.getElementById("name1").value=="")
       {
         alert("请输入你的大名");
        }
    }
    </script>
      </head>
      
      <body>
          <from name="form1" action="" method="post">
          您的大名:<INPUT type="text" name="name1" id="name1">&nbsp;<font color="red">*</font><br>
             <input type="submit" value="确定" onClick="result();">
          <input type="reset" value="重填">
          </from>
      </body>
    </html>换成这样试试
      

  7.   

    http://www.9-24.com
    全ajax+.NET构建的大型商务社区站点实现高速缓寸和高速访问速度
    值的学习
      

  8.   

    if (document.form1.name1.value=="")
    写的有问题,应该写if(name1.value=="")就可以了。