JQuery/JS插件 数组转换为Table
//数组 转换为 table
var arr = [{ "D_AlarmValue": 7.00, "D_Code": "002", "D_CurValue": 0.0, "D_Name": "环境风速", "D_Position": "K5+232", "D_Project": "城开B2项目", "D_State": 1, "D_Type": "风速传感器", "D_Unit": "m/s" }, { "D_AlarmValue": 7.00, "D_Code": "003", "D_CurValue": 0.0, "D_Name": "水质监测", "D_Position": "K5+232", "D_Project": "城开B2项目", "D_State": 1, "D_Type": "风速传感器", "D_Unit": "mg/L" }, { "D_AlarmValue": 7.00, "D_Code": "005", "D_CurValue": 0.0, "D_Name": "环境噪音", "D_Position": "K5+232", "D_Project": "城开B2项目", "D_State": 1, "D_Type": "风速传感器", "D_Unit": "分贝" }, { "D_AlarmValue": 7.00, "D_Code": "006", "D_CurValue": 0.0, "D_Name": "水流监测", "D_Position": "K5+232", "D_Project": "城开B2项目", "D_State": 1, "D_Type": "风速传感器", "D_Unit": "T/H" }, { "D_AlarmValue": 7.00, "D_Code": "008", "D_CurValue": 0.0, "D_Name": "粉尘监测", "D_Position": "K5+232", "D_Project": "城开B2项目", "D_State": 1, "D_Type": "风速传感器", "D_Unit": "T/H" }, { "D_AlarmValue": 7.00, "D_Code": "FF26", "D_CurValue": 0.0, "D_Name": "防水布台车风速", "D_Position": "B2进口右洞防水布台车", "D_Project": "城开B2项目", "D_State": 1, "D_Type": "风速传感器", "D_Unit": "m/s" }, { "D_AlarmValue": 24.00, "D_Code": "FF52", "D_CurValue": 1.30, "D_Name": "掌子面一氧化碳", "D_Position": "B2出口左洞掌子面", "D_Project": "城开B2项目", "D_State": 1, "D_Type": "一氧化碳传感器", "D_Unit": "PPM" }, { "D_AlarmValue": 0.50, "D_Code": "2121", "D_CurValue": 0.0, "D_Name": "洞口瓦斯", "D_Position": "B2出口左洞洞口", "D_Project": "城开B2项目", "D_State": 1, "D_Type": "瓦斯传感器", "D_Unit": "%" }, { "D_AlarmValue": 10.00, "D_Code": "FF54", "D_CurValue": 0.0, "D_Name": "掌子面硫化氢", "D_Position": "B2出口左洞掌子面", "D_Project": "城开B2项目", "D_State": 1, "D_Type": "硫化氢传感器", "D_Unit": "PPM" }, { "D_AlarmValue": 10.00, "D_Code": "FF24", "D_CurValue": 0.0, "D_Name": "掌子面硫化氢", "D_Position": "B2进口左洞掌子面", "D_Project": "城开B2项目", "D_State": 1, "D_Type": "硫化氢传感器", "D_Unit": "PPM" }, { "D_AlarmValue": 24.00, "D_Code": "FF55", "D_CurValue": 1.30, "D_Name": "掌子面一氧化碳", "D_Position": "B2出口右洞掌子面", "D_Project": "城开B2项目", "D_State": 1, "D_Type": "一氧化碳传感器", "D_Unit": "PPM" }, { "D_AlarmValue": 0.50, "D_Code": "FF20", "D_CurValue": 0.0, "D_Name": "防水布台车瓦斯", "D_Position": "B2进口右洞防水布台车", "D_Project": "城开B2项目", "D_State": 1, "D_Type": "瓦斯传感器", "D_Unit": "%" }, { "D_AlarmValue": 10.00, "D_Code": "FF58", "D_CurValue": 0.0, "D_Name": "掌子面硫化氢", "D_Position": "B2出口右洞掌子面", "D_Project": "城开B2项目", "D_State": 1, "D_Type": "硫化氢传感器", "D_Unit": "PPM" }, { "D_AlarmValue": 2000.00, "D_Code": "1118", "D_CurValue": 400.00, "D_Name": "掌子面二氧化碳", "D_Position": "B2进口左洞掌子面", "D_Project": "城开B2项目", "D_State": 1, "D_Type": "二氧化碳传感器", "D_Unit": "PPM" }, { "D_AlarmValue": 2000.00, "D_Code": "1115", "D_CurValue": 407.00, "D_Name": "掌子面二氧化碳", "D_Position": "B2出口左洞掌子面", "D_Project": "城开B2项目", "D_State": 1, "D_Type": "二氧化碳传感器", "D_Unit": "PPM" }, { "D_AlarmValue": 7.00, "D_Code": "FF49", "D_CurValue": 0.0, "D_Name": "防水布台车风速", "D_Position": "B2出口左洞防水布台车", "D_Project": "城开B2项目", "D_State": 1, "D_Type": "风速传感器", "D_Unit": "m/s" }, { "D_AlarmValue": 7.00, "D_Code": "FF13", "D_CurValue": 0.0, "D_Name": "防水布台车风速", "D_Position": "B2进口左洞防水布台车", "D_Project": "城开B2项目", "D_State": 1, "D_Type": "风速传感器", "D_Unit": "m/s" }, { "D_AlarmValue": 0.50, "D_Code": "1211", "D_CurValue": 0.0, "D_Name": "洞口瓦斯", "D_Position": "B2出口右洞洞口", "D_Project": "城开B2项目", "D_State": 1, "D_Type": "瓦斯传感器", "D_Unit": "%" }, { "D_AlarmValue": 2000.00, "D_Code": "1117", "D_CurValue": 518.00, "D_Name": "掌子面二氧化碳", "D_Position": "B2进口右洞掌子面", "D_Project": "城开B2项目", "D_State": 1, "D_Type": "二氧化碳传感器", "D_Unit": "PPM" }, { "D_AlarmValue": 2000.00, "D_Code": "1116", "D_CurValue": 404.00, "D_Name": "掌子面二氧化碳", "D_Position": "B2出口右洞掌子面", "D_Project": "城开B2项目", "D_State": 1, "D_Type": "二氧化碳传感器", "D_Unit": "PPM" }, { "D_AlarmValue": 0.50, "D_Code": "FF35", "D_CurValue": 0.0, "D_Name": "掌子面瓦斯", "D_Position": "B2进口右洞掌子面", "D_Project": "城开B2项目", "D_State": 1, "D_Type": "瓦斯传感器", "D_Unit": "%" }, { "D_AlarmValue": 7.00, "D_Code": "1111", "D_CurValue": 1.10, "D_Name": "洞口风速", "D_Position": "B2出口右洞洞口", "D_Project": "城开B2项目", "D_State": 1, "D_Type": "风速传感器", "D_Unit": "m/s" }, { "D_AlarmValue": 0.50, "D_Code": "FF39", "D_CurValue": 0.14, "D_Name": "掌子面瓦斯", "D_Position": "B2出口左洞掌子面", "D_Project": "城开B2项目", "D_State": 1, "D_Type": "瓦斯传感器", "D_Unit": "%" }, { "D_AlarmValue": 7.00, "D_Code": "FF14", "D_CurValue": 0.0, "D_Name": "洞口风速", "D_Position": "B2进口左洞洞口", "D_Project": "城开B2项目", "D_State": 1, "D_Type": "风速传感器", "D_Unit": "m/s" }, { "D_AlarmValue": 0.50, "D_Code": "FF63", "D_CurValue": 0.12, "D_Name": "掌子面瓦斯", "D_Position": "B2出口右洞掌子面", "D_Project": "城开B2项目", "D_State": 1, "D_Type": "瓦斯传感器", "D_Unit": "%" }, { "D_AlarmValue": 0.48, "D_Code": "FF34", "D_CurValue": 0.0, "D_Name": "洞口瓦斯", "D_Position": "B2进口右洞洞口", "D_Project": "城开B2项目", "D_State": 1, "D_Type": "瓦斯传感器", "D_Unit": "%" }, { "D_AlarmValue": 7.00, "D_Code": "FF30", "D_CurValue": 1.20, "D_Name": "洞口风速", "D_Position": "B2进口右洞洞口", "D_Project": "城开B2项目", "D_State": 1, "D_Type": "风速传感器", "D_Unit": "m/s" }, { "D_AlarmValue": 10.00, "D_Code": "FF40", "D_CurValue": 0.0, "D_Name": "掌子面硫化氢", "D_Position": "B2进口右洞掌子面", "D_Project": "城开B2项目", "D_State": 1, "D_Type": "硫化氢传感器", "D_Unit": "PPM" }, { "D_AlarmValue": 7.00, "D_Code": "2221", "D_CurValue": 0.70, "D_Name": "洞口风速", "D_Position": "B2出口左洞洞口", "D_Project": "城开B2项目", "D_State": 1, "D_Type": "风速传感器", "D_Unit": "m/s" }, { "D_AlarmValue": 24.00, "D_Code": "FF22", "D_CurValue": 1.30, "D_Name": "掌子面一氧化碳", "D_Position": "B2进口左洞掌子面", "D_Project": "城开B2项目", "D_State": 1, "D_Type": "一氧化碳传感器", "D_Unit": "PPM" }, { "D_AlarmValue": 7.00, "D_Code": "FF53", "D_CurValue": 0.0, "D_Name": "防水布台车风速", "D_Position": "B2出口右洞防水布台车", "D_Project": "城开B2项目", "D_State": 1, "D_Type": "风速传感器", "D_Unit": "m/s" }, { "D_AlarmValue": 0.50, "D_Code": "FF72", "D_CurValue": 0.02, "D_Name": "防水布台车瓦斯", "D_Position": "B2出口左洞防水布台车", "D_Project": "城开B2项目", "D_State": 1, "D_Type": "瓦斯传感器", "D_Unit": "%" }, { "D_AlarmValue": 0.50, "D_Code": "FF44", "D_CurValue": 0.13, "D_Name": "洞口瓦斯", "D_Position": "B2进口左洞洞口", "D_Project": "城开B2项目", "D_State": 1, "D_Type": "瓦斯传感器", "D_Unit": "%" }, { "D_AlarmValue": 0.50, "D_Code": "FF43", "D_CurValue": 0.0, "D_Name": "掌子面瓦斯", "D_Position": "B2进口左洞掌子面", "D_Project": "城开B2项目", "D_State": 1, "D_Type": "瓦斯传感器", "D_Unit": "%" }, { "D_AlarmValue": 0.50, "D_Code": "FF29", "D_CurValue": 0.0, "D_Name": "防水布台车瓦斯", "D_Position": "B2进口左洞防水布台车", "D_Project": "城开B2项目", "D_State": 1, "D_Type": "瓦斯传感器", "D_Unit": "%" }, { "D_AlarmValue": 0.50, "D_Code": "FF56", "D_CurValue": 0.0, "D_Name": "防水布台车瓦斯", "D_Position": "B2出口右洞防水布台车", "D_Project": "城开B2项目", "D_State": 1, "D_Type": "瓦斯传感器", "D_Unit": "%" }, { "D_AlarmValue": 24.00, "D_Code": "FF28", "D_CurValue": 5.00, "D_Name": "掌子面一氧化碳", "D_Position": "B2进口右洞掌子面", "D_Project": "城开B2项目", "D_State": 1, "D_Type": "一氧化碳传感器", "D_Unit": "PPM" }]; var strHtml = ''; //th
strHtml += '<tr>';
for (var key in arr[0]) {
strHtml += '<th>' + key + '</th>';
}
strHtml += '</tr>'; //td
for (var i = 0; i < arr.length; i++) {
var item = arr[i];
strHtml += '<tr>';
//拼td
for(var key in item){
var value = item[key];
strHtml += '<td>' + value + '</td>';
}
strHtml += '</tr>';
} document.getElementById('t1').innerHTML = strHtml;
JQuery/JS插件 数组转换为Table的更多相关文章
- JQuery/JS插件 jsTree加载树,预先加载,初始化时加载前三级节点,当展开第三级节点时 就加载该节点下的所有子节点
jsTree加载树, 初始化时 加载前三级节点, 当展开第三级节点时 就加载该节点下的所有子节点 html: <!DOCTYPE html> <html> <head&g ...
- JQuery/JS插件 jsTree加载树,普通加载,点一级加载一级
前端: <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <tit ...
- js一维数组转换为二维数组
function arrTrans(num, arr) { // 一维数组转换为二维数组 const iconsArr = []; // 声明数组 arr.forEach((item, index) ...
- JQuery/JS插件 zTree树,点击当前节点展开,其他节点关闭
好像没找到现成的,就自己写了一个demo. 效果如下: 代码: <!DOCTYPE html> <html> <head> <meta http-equiv= ...
- JQuery/JS插件 日期插件
用于日期的计算,功能比较全,我常用的主要是日期的计算(多一天少一天,或者添加几个月等),日期格式化 网址:http://momentjs.cn/ 测试代码: <!DOCTYPE html> ...
- jquery/js分割数组
substr(star[,length]);//star起始位置 length截取的长度 substring(star,end);//star起始位置,end结束位置 都是以0开始的索引值
- JavaScript将数组转换为链表
JS中将数组转换为链表 /** * 将数组转换为链表 * @param array arr 需要转换的数组 * @param int type 转换的类型,0为单链表,1为循环链表 * @return ...
- Jquery 插件\Js 插件收集
1.linq.js 使得js 的数组像c#的linq操作一下样 http://linqjs.codeplex.com/ 2.分页插件 https://github.com/mricle/Mricode ...
- 【PC端】jQuery+PHP实现浏览更多内容(jquery.more.js插件)
参数说明: 'amount' : '10', //每次显示记录数 'address' : 'comments.php', //请求后台的地址 'format' : 'json', //数据传输格式 ' ...
随机推荐
- h5页面 内嵌h5页面遇到的问题
1.input框无法获取焦点输入内容 input { -webkit-user-select: auto; } 2.div里面放img标签有3px的距离 div { font-size: 0; } i ...
- 【SpringData学习】
1.注解@Modifying 在springData中,大部分给出的接口都是查询的,那要进行删除和更新的时候,大部分都需要使用@Query 进行手写代码.并且需要使用@Modifying注解. 使用场 ...
- 详解Makefile 函数的语法与使用 (转)
使用函数: 在Makefile中可以使用函数来处理变量,从而让我们的命令或是规则更为的灵活和具有智能.make所支持的函数也不算很多,不过已经足够我们的操作了.函数调用后,函数的返回值可以当做变量来使 ...
- 【leetcode】438. Find All Anagrams in a String
problem 438. Find All Anagrams in a String solution1: class Solution { public: vector<int> fin ...
- echarts移除百度地图logo方法
移除百度地图LOGO和版权信息 在jsp头上加上如下代码即可: <style type="text/css"> .anchorBL{ display:none } &l ...
- #20175120彭宇辰 java第四周总结
教材学习内容总结 -第五章 子类与继承 子类的定义-class 子类名 extends 父类名ps:-任何类都是object的子类-每个类有且仅有一个父类,多个或0个子类 同一包里的继承性-除了pri ...
- _proto_ && prototype (原型 && 原型链)
原型一直都是JavaScript基础里面的痛点,因为在JavaScript里面没有类的概念,都是通过原型对象来实现继承,下面的这个图很好的说明几者之间的关系! a.__proto__ = A.prot ...
- (26)基于cookie的登陆认证(写入cookie、删除cookie、登陆后所有域下的网页都可访问、登陆成功跳转至用户开始访问的页面、使用装饰器完成所有页面的登陆认证)
获取cookie request.COOKIES['key'] request.get_signed_cookie(key, default=RAISE_ERROR, salt='', max_age ...
- kindle試玩
Q:試玩感受如何? Pros 按這個版本,沒有燈,在光纖不好的時候看起來很累.但陽光好的時候看起來很爽 重量很輕,比手機邀請很多 看書很容易沉浸下去,這一點比收集好狠毒 Cons 網上說看pdf不大行 ...
- HBase各版本对Hadoop版本的支持情况
转载自:http://blog.csdn.net/sunny05296/article/details/54089194 安装HBase时,要考虑选择正确的Hadoop版本,否则可能出现不兼容的情况. ...