我希望没有填入姓名信息直接提交时,会弹出alert("你没有输入名字!")的提示框,可是不知道代码哪里不对,请大侠指点一下谢谢代码如下<head>
<title>表单验证属性实例
</title><script language="javascript" type="text/javascript"><!--
   function show()
   {    if(document.form1.name.value=="")
{
   alert("你没有输入名字!");
reture false;
}
   }
//--></script></head>
<body>
<form action="" method="post" name="form1" onSubmit="return show()" onReset=alert("你点了重置了")>
姓名:<p>
<input  name="name" ><p>
<input type=submit value=提交>
<input type=reset  value=重置>
</form>
</body>
</html>

解决方案 »

  1.   

    name是form的一个属性,把input的名称换一下。
      

  2.   


    <html>
    <head>
    <script language="javascript" type="text/javascript">
    function show()
    {
       if(document.form1.aa.value=="")
    {
          alert("aa");
       
       }
       else
    {
          document.form1.submit();
       }
      
    }</script></head>
    <body>
    <form action="#" method="post" name="form1" >
    姓名:<p>
    <input name="aa" ><p>
    <input type="button" value=提交 onclick="javascript:show()">
    <input type="reset" value=重置>
    </form>
    </body>
    </html>
    你用混了
      

  3.   

    我发现了
    reture false;
    应该时return~~~~~