首页 > Web开发 > 详细

JS删除练习

时间:2014-06-14 12:38:43      阅读:487      评论:0      收藏:0      [点我收藏+]
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>
    <style type="text/css">
        #tbList {
            margin: 10px auto;
            border-collapse: collapse; /*是否合并为单一边框*/
        }
    </style>
    <script type="text/javascript">
        var arr = [{
            "title": "一个C#问题", "name": "张三", "date": "2014-05-24"
        },
        {
            "title": "一个C#问题", "name": "张三", "date": "2014-05-24"
        }, {
            "title": "一个C#问题", "name": "张三", "date": "2014-05-24"
        }, {
            "title": "一个C#问题", "name": "张三", "date": "2014-05-24"
        }, {
            "title": "一个C#问题", "name": "张三", "date": "2014-05-24"
        }
        ];
        window.onload = function () {
            loadData();
            //方法不能写在这里面
        }
        function loadData() {
            var tb = document.getElementById("tbList");

            var trNew = document.createElement("tr");
            for (var j = 0; j < arr[i].length; j++) {
                var td1 = document.createElement("td");
                td1.innerHTML = arr[i].title;
                trNew.appendChild(td1);
                tb.appendChild(trNew);
            }
        }
    </script>
</head>
<body>
    <table id="tbList" border="1">
        <tr>
            <td>序号</td>
            <td>标题</td>
            <td>发件人</td>
            <td>发件时间</td>

        </tr>
    </table>
</body>
</html>

  

JS删除练习,布布扣,bubuko.com

JS删除练习

原文:http://www.cnblogs.com/sumg/p/3787761.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!