<%@ page contentType="text/html; charset=gb2312" %>
<head>
<title>校验用户输入数据</title>
<script language="javascript">
function pagecheck()
{
  var inst="爱好:";
  if(document.myform.txt1.value=="")
  {
     alert("请输入姓名! ");
  }
  else
  {
     alert("姓名: "+document.myform.txt1.value);
 if(document.myform.sex[0].checked)  alert("性别:男");
 else alert("性别:女") ;
 if(document.myform.inst[0].checked)  inst+="游泳";
 if(document.myform.inst[0].checked)  inst+=", 滑冰";
 if(document.myform.inst[0].checked)  inst+=", 散步";
 if(inst=="爱好:")
 alert("赶紧培养一个爱好吧!");
 else
 alert("inst");
 
  }
}
</script>
</head><body>
   <form name="myform" id="Form1" >
      <p>请输入你的姓名:<input type="text" name="txt1" value="" id="Text1">  
      <br>
  <br>
  性别:
  <br>
  男<input type="radio" value="男" name="sex" checked>
  女<input type="radio" value="女" name="sex" id="Radio2">
  <br>
  <br>
  请选择你的爱好:
  <br>
  游泳<input type="checkbox" value="游泳" name="inst" checked id="Checkbox1">
  滑冰<input type="checkbox" value="滑冰" name="inst" id="Checkbox2">
  散步<input type="checkbox" value="散步" name="inst" id="Chedkbox3">
    
     </p>
 <input type="button" onclick="pagecheck()" value="提交内容">
</form> 
</body> 
</html>