<script language="javascript" >
  function reg(){
/*
var name = document.getElementById("name");
var age = document.getElementById("age");
var sex = document.getElementById("sex");*/
var name = document.form1.textfield;
var age = document.form1.textfield2;
var sex = document.form1.textfield3;
var num = "10";
if(name.value == ""){
alert("name不能为空!");
   }
if(age.value == ""){
alert("age不能为空!");
return false;
}
if(sex.value == ""){
alert("sex不能为空!");
return false;
}
if(age.value != eval("10")){
alert("no equals!");
return false;
}
return true;
}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head><body>
  <form id="form1" name="form1" method="post" action="second.html" onsubmit="return reg()">
 <table cellpadding="1px" cellspacing="1px" bgcolor="#00FFFF" border="1px" width="100px" height="80px">
         <tr height="30px">
            <td height="30px" width="40px" >姓名</td>
            <td height="30px" width="40px" >年龄</td>
            <td height="30px" width="40px" >性别</td>
         </tr>
         <tr height="30px">
            <td height="30px" width="40px" ><label for="textfield"></label>
           <input type="text" name="textfield" id="name" /></td>
            <td height="30px" width="40px">
              <label for="textfield2"></label>
           <input type="text" name="textfield2" id="age" /></td>
            <td height="30px" width="40px" >
              <label for="textfield3"></label>
            <input type="text" name="textfield3" id="sex"/></td>
    </tr>
    </table>
  <input name="注册" type="submit" value="注册" />
  </form>
</body>
</html>