<td><center>欢迎你~<% out.print(session.getAttribute("number").toString()) ;%></center></td>
<p class="qq"> 修改你的个人资料</p>
 
 <center><td colspan="2" class="qq"><form name="form11" method="post" action="change.jsp">
<input type="submit" name="button" id="button" value="提交">
   <input type="reset" name="button2" id="button2" value="重置"></center>
  </td>
 
<table width="450" height="100" border="1" align="center">
  <tr>
    <td class="qq">你的id:</td>
    <td>
    *不可修改</td>
  </tr>
  <tr>
    <td width="46" class="qq">昵称:</td>
    <td width="188">
      <input type="text" name="newname" id="newname" >
   *必填项 </td>
  </tr>
  <tr>
    <td class="qq">密码:</td>
    <td>
      <label for="textfield10"></label>
      <input type="password" name="passw" >
    *必填项</td>
  </tr>
  <tr>
    <td class="qq"><p>年龄:</p></td>
    <td>
      
      <input type="text" name="age" >
    *必填项 </td>
  </tr>
  <tr>
    <td class="qq">性别:boy&girl</td>
    <td>
 
       <input type="text" name="sex" >
  *必填项 </td>
  </tr>
  <tr>
    <td class="qq">地区:</td>
    <td>
    
      <input type="text" name="area">
  *必填项</td>
  </tr>
  <tr>
    <td class="qq">工作:</td>
    <td>
       
      <input type="text" name="job" >
</td>
  </tr>
  <tr>
    <td class="qq">薪酬:</td>
    <td>
      
      <input type="text" name="salary" >
  </td>
  </tr>
  <tr>
    <td class="qq">身高:</td>
    <td>
      
      <input type="text" name="height" >
</td>
  </tr>
  <tr>
    <td class="qq">爱好:</td>
    <td>
    
      <input type="text" name="habit">
</td>
  </tr>
  <tr>
    <td class="qq">个人简介:</td>
    <td>
 
      <textarea name="introdction" id="introduction"></textarea>
    </form></td>
  </tr>
  </table>
  <center>
 <form name="form1" method="post" action="person.jsp">
    <input type="submit" name="button3" id="button3" value="返回">
  </form>
  </center>  
</body>
</html> function  CheckForm() 
 { 
 if  (!document.getElementById('newname').value)  {  
 alert("请输入..."); 
 document.getElementById('newname').focus(); 
 return  false; 
 } 
 return  true; 
 } 

解决方案 »

  1.   

     function  CheckForm() 
     { 
     if  (!document.getElementById('newname').value)  {  
     alert("请输入..."); 
     document.getElementById('newname').focus(); 
     return  false; 
     } 
     return  true; 
     } 

    不对啊,还是没反应 %>_<%
    是不是我的位置放错了?
      

  2.   

    照道理没错啊,你script这样定义内嵌样式看看?试试
    <script type="text/javascript">
     function  CheckForm() 
     { 
     if  (!document.getElementById('newname').value)  {  
     alert("请输入..."); 
     document.getElementById('newname').focus(); 
     return  false; 
     } 
     return  true; 
     } 
    </script>
      

  3.   

    <form name="form11" method="post" action="change.jsp" onsubmit="return CheckForm() ">
      

  4.   

    是不是也应该去掉空格啊!
    <script  language="javascript"> 
    var reg=/^\S+$/; 
     function  CheckForm() {  
     if(!reg.test(document.form11.name.value)){  
         alert("请输入您姓名!"); 
         document.form11.name.focus(); 
         return  false; 
         } 
     } 
    </script> 
      

  5.   


    <script  language="javascript"> 
    <!-- 
    function  CheckForm() 
    {  
    if  (document.form11.newname.value.length  ==  0)  {  
    alert("请输入您姓名!"); 
    document.form11.newname.focus(); 
    return  false; 

    return  true; 

    --> 
    </script> <td><center>欢迎你~<% out.print(session.getAttribute("number").toString()) ;%></center></td>
    <p class="qq"> 修改你的个人资料</p> <center><td colspan="2" class="qq"><form name="form11" method="post" action="change.jsp" onsubmit="return CheckForm()">
    <input type="submit" name="button" id="button" value="提交">
       <input type="reset" name="button2" id="button2" value="重置"></center>
      </td><table width="450" height="100" border="1" align="center">
      <tr>
        <td class="qq">你的id:</td>
        <td>
        *不可修改</td>
      </tr>
      <tr>
        <td width="46" class="qq">昵称:</td>
        <td width="188">
          <input type="text" name="newname" >
       *必填项 </td>
      </tr>
      <tr>
        <td class="qq">密码:</td>
        <td>
          <label for="textfield10"></label>
          <input type="password" name="passw" >
        *必填项</td>
      </tr>
      <tr>
        <td class="qq"><p>年龄:</p></td>
        <td>
         
          <input type="text" name="age" >
        *必填项 </td>
      </tr>
      <tr>
        <td class="qq">性别:boy&girl</td>
        <td>       <input type="text" name="sex" >
      *必填项 </td>
      </tr>
      <tr>
        <td class="qq">地区:</td>
        <td>
       
          <input type="text" name="area">
      *必填项</td>
      </tr>
      <tr>
        <td class="qq">工作:</td>
        <td>
          
          <input type="text" name="job" >
    </td>
      </tr>
      <tr>
        <td class="qq">薪酬:</td>
        <td>
         
          <input type="text" name="salary" >
      </td>
      </tr>
      <tr>
        <td class="qq">身高:</td>
        <td>
         
          <input type="text" name="height" >
    </td>
      </tr>
      <tr>
        <td class="qq">爱好:</td>
        <td>
       
          <input type="text" name="habit">
    </td>
      </tr>
      <tr>
        <td class="qq">个人简介:</td>
        <td>      <textarea name="introdction" id="introduction"></textarea>
        </form></td>
      </tr>
      </table>
      <center>
     <form name="form1" method="post" action="person.jsp">
        <input type="submit" name="button3" id="button3" value="返回">
      </form>
      </center> 
    </body>
    </html>
      

  6.   

    我去,你是在搞笑吗,form11和form1这种低级错误讨论半天