假设list格式如下list = [{"id":"1","name":"A","age":20}, {"id":"2","name":"B","age":21},{"id":"3","name":"C","age":22}];

最简单的就 是

for(var index = 0,l = list.length;index<l;index++)

{   $("#students tbody").append("<tr><td>"+ list[index].id +"</td><td>"+ list[index].name+"< /td><td>"+ list[index].age +"</td>< /tr>");  }

students 是table的id

<!DOCTYPE html PUBLIC "-//W3C //DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD /xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999 /xhtml"><head>

<meta http-equiv="Content-Type" content="text /html; charset=gb2312" />

<title>无标题文档</title>

</head>

<script language="javascript" src="/js/jquery-1.4.4.js" type="text /javascript">< /script>

<script language="javascript" type="text/javascript">

$(document).ready(function () {

var list = [{"id":"1","name":"A","age":20}, {"id":"2","name":"B","age":21}, {"id":"3","name":"C","age":22}];

for(var index = 0,l = list.length; index<l;index++) {

$("#students tbody").append("<tr><td>"+ list[index].id +"</td><td>"+ list[index].name+"< /td><td>"+ list[index].age +"</td>< /tr>");

} })

</script>

<body>

<table id="students">

<thead>      <tr>       <th>学 号</th>        <th>姓名</th>        <th>年龄< /th>      </tr>    </thead>

<tbody>

</tbody>

</table>

</body>

最新文章

  1. 最新的hosts
  2. Unity内存申请和释放
  3. php获取服务器时间的代码
  4. HDOJ 1042 N! -- 大数运算
  5. Top WAF
  6. DP(斜率优化):HDU 3507 Print Article
  7. oracle中存储过程详解
  8. 解决IE6下a标签的onclick事件里的超链接不跳转问题
  9. 【iOS开发-60】案例学习:多组数据的tableView设置、添加右側组索引、多层数据模型设置以及valueForKeyPath
  10. shell脚本 整数比较
  11. 毕业论文内容框架指导-适用于MIS系统
  12. LeetCode Javascript实现 100. Same Tree 171. Excel Sheet Column Number
  13. [CQOI2009] 中位数
  14. Makefile模板(C++)
  15. Maven的porfile与SpringBoot的profile结合使用详解
  16. Mysql:索引实战
  17. Vue Resource root options not used?
  18. eclipse repository connector
  19. c#中连接数据库
  20. 2017-2018-1 20155234 实验三 实时系统及mypwd实现

热门文章

  1. iOS Png Crush 错误
  2. django系列6--Ajax04 请求设置(设置csrf_token)
  3. python中的列表和元组
  4. 设置、读取、删除cookie
  5. linux安装spark-2.3.0集群
  6. 在PL/SQL里直接插入日期时提示 is not a valid date and time的解决方法
  7. Lucene7.4学习和简单使用
  8. Machine learning 第7周编程作业 SVM
  9. [HNOI2019]多边形
  10. abp angular 前端权限控制