<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>挑战题</title>
<script src="http://libs.baidu.com/jquery/1.8.2/jquery.js" type="text/javascript"></script>
</head>
<body>
<table id="tab1">
<tr>
<th>编号</th>
<th>姓名</th>
<th>年龄</th>
<th>性别</th>
<th>班级</th>
</tr>
</table>
<script type="text/javascript">
var stus = [
{name :"tom",age :"18",sex :"男",classId :"1"},
{name :"jack",age:"29",sex :"男",classId :"1"},
{name:"mary",age:"17",sex:"女",classId:"2"},
];
$(function(){
$.each(stus,function(index,stu){
$("#tab1").append(
"<tr><td>"+parseInt(index+1)+"</td>"+
"<td>"+stu.name+"</td>"+
"<td>"+stu.age+"</td>"+
"<td>"+stu.sex+"</td>"+
"<td>"+stu.classId+"</td></tr>"+
);
});
});
</script>
</body>
</html>