当前位置: 代码迷 >> JavaScript >> 怎么把这些数据一个页面表格输出
  详细解决方案

怎么把这些数据一个页面表格输出

热度:197   发布时间:2012-05-03 14:06:56.0
如何把这些数据一个页面表格输出?
http://hqquery.jrj.com.cn/sflow.do?sort=min&page=1&order=desc&size=50

var sflow={
Summary:{A1:48,A2:1,A3:2366,A4:"2012-03-21",A5:"2012-03-21 15:45:16"},
StockHq:[
  {stkn:"中国铝业",stki:"sh601600",stkc:"601600",np:7.59,pl:10.0,hlp:0.69,tm:96245.05,tr:1.34,min:60996.16,pintm:63.38,pinfmv:0.84,min5:55970.4,pintm5:38.53,pinfmv5:0.77,min10:52837.26,pintm10:24.07,pinfmv10:0.73,min20:49421.07,pintm20:14.88,pinfmv20:0.68,min30:49075.91,pintm30:11.87,pinfmv30:0.67,pbig2:0.0,bid:400115944,bname:"有色金属行业"},
  {stkn:"金钼股份",stki:"sh601958",stkc:"601958",np:15.48,pl:7.05,hlp:1.02,tm:120968.68,tr:2.41,min:40033.43,pintm:33.09,pinfmv:0.8,min5:52982.85,pintm5:21.23,pinfmv5:1.06,min10:51345.64,pintm10:14.66,pinfmv10:1.03,min20:32209.11,pintm20:6.17,pinfmv20:0.64,min30:37070.45,pintm30:5.33,pinfmv30:0.74,pbig2:0.0,bid:400115944,bname:"有色金属行业"},
  {stkn:"章源钨业",stki:"sz002378",stkc:"002378",np:35.18,pl:10.01,hlp:3.2,tm:65299.92,tr:24.32,min:36290.28,pintm:55.57,pinfmv:13.31,min5:32119.18,pintm5:16.74,pinfmv5:11.78,min10:20089.29,pintm10:5.2,pinfmv10:7.37,min20:59726.07,pintm20:8.74,pinfmv20:21.91,min30:55284.4,pintm30:7.35,pinfmv30:20.28,pbig2:0.0,bid:400115944,bname:"有色金属行业"},

......

  {stkn:"四川长虹",stki:"sh600839",stkc:"600839",np:2.48,pl:2.48,hlp:0.06,tm:30803.02,tr:2.73,min:4268.88,pintm:13.86,pinfmv:0.37,min5:-1689.64,pintm5:2.17,pinfmv5:0.15,min10:-21620.4,pintm10:13.17,pinfmv10:1.89,min20:17559.14,pintm20:3.41,pinfmv20:1.54,min30:35196.0,pintm30:5.23,pinfmv30:3.08,pbig2:0.0,bid:400115922,bname:"电子元器件行业"},
  {stkn:"北巴传媒",stki:"sh600386",stkc:"600386",np:9.96,pl:0.91,hlp:0.09,tm:25485.93,tr:6.41,min:4263.76,pintm:16.73,pinfmv:1.06,min5:26244.03,pintm5:22.9,pinfmv5:6.54,min10:27800.63,pintm10:13.95,pinfmv10:6.92,min20:20613.41,pintm20:7.56,pinfmv20:5.13,min30:23912.55,pintm30:6.54,pinfmv30:5.95,pbig2:0.0,bid:400115919,bname:"传播与文化"},
  {stkn:"平庄能源",stki:"sz000780",stkc:"000780",np:13.8,pl:3.6,hlp:0.48,tm:23769.2,tr:1.71,min:4255.32,pintm:17.9,pinfmv:0.3,min5:12393.94,pintm5:14.18,pinfmv5:0.89,min10:9335.4,pintm10:7.68,pinfmv10:0.67,min20:3471.52,pintm20:1.73,pinfmv20:0.25,min30:371.64,pintm30:0.14,pinfmv30:0.03,pbig2:0.0,bid:400115934,bname:"能源行业"}]
}

------解决方案--------------------
HTML code
<script>
var html = ""
var data = sflow.StockHq;
for(var i = 0 ; i < data.length ; i ++)
{
    html += "<tr>"
    for(var key in data[i])
    {
        html += "<td>"+ data[i][key] +"</td>"
    }
    html += "</tr>";
}
html = "<table>"+ html +"</table>"
document.body.innerHTML = html;
</script> 
  相关解决方案