解决方案 »

  1.   

    <html xmlns="http://www.w3.org/1999/xhtml"><head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
    <title>无标题文档</title>
    </head><body>
    <script type="text/javascript">
    var str = '1*无效*失败*5*2014-01-10 09:23:46&1*有效*成功*5*2014-01-10 09:23:50&';
    var split = str.substr(0,str.length -1).split('&');
    //console.log(split);
    var table = "<table>";
    for(var i =0;i<split.length;i++){

    var splitTr = split[i].substr(2,split[i].length).split('*');

    table += "<tr>";
    for (var n = 0;n<splitTr.length;n++) {
    table += "<td>"+splitTr[n]+"</td>"
    }
    table += "</tr>";
    }
    table += "</table>";
    console.log(table)
    </script>
    </body></html>