<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>收集信息</title>
<style type="text/css">
<!--
.STYLE1 {font-size: 16px}
-->
#top,#bottom
{
 width:800px;
 height:400px;
 margin:auto;
 border:1px #999999 solid;
}
</style>
<script type="text/javascript">
function getInfo()
{
 //判断用户名是否为空
 //var uName=document.forms["f1"].txtUserName;
 //var uName=document.all.txtUserName;
 var uName=document.getElementById("txtUserName");
 if(uName.value=="")
 {
  alert("用户名不能为空");
  uName.focus();
  return;
 }
 //获取用户选择的年
 var year=document.all.year.options[document.all.year.selectedIndex].value;
 //获取用户选择的月
 var month=document.all.month.options[document.all.month.selectedIndex].value;
 //获取用户选择的日
 var day=document.all.day.options[document.all.day.selectedIndex].value;
 var birthday=year+"年"+month+"月"+day+"日";
 var sex=document.all.sexMan.checked?"男":"女";
 var love="";
 var strLove=document.forms[0].ck;
 for(var i=0;i<strLove.length;i++)
 {
  if(strLove[i].checked==true)
  {
   love=love+strLove[i].value+"\t";
  }
 }
 var strTable="<table border='1' width='800' style='border-collapse:collapse'><tr align='center'><td colspan='2' >学生信息</td></tr><tr ><td>姓名</td><td>"+uName.value+"</td></tr><tr ><td>性别</td><td>"+sex+"</td></tr><tr ><td>出生日期</td><td>"+birthday+"</td></tr><tr ><td>兴趣</td><td>"+love+"</td></tr></table>";
 //把id为bottom的div显示出来
 //bottom.style.display="";
 bottom.style.display="block";
 bottom.innerHTML=strTable;
}
function init()
{
 //隐藏id为bottom的div
 bottom.style.display="none";
}
</script>
</head>

<body onload="init()">
<div >
</div>
</body>
</html>

相关文章: