<!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta charset="utf-8" /> <title>NetnrRun</title> </head> <body> </body> </html>
var v1 = [ { id: 1, title: "今天", md: "今天是个好日子" }, { id: 2, title: "明天", md: "明天是个好日子" }, { id: 3, title: "后台", md: "后台是个好日子" }, { id: 4, title: "大", md: "<input onclick='alert(1)' placeholder='click here' />" }, ]; function view(data) { var htm = []; htm.push('<table border=1>') data.forEach(item => { console.log(item) htm.push('<tr>'); htm.push('<td>' + item.id + '</td>'); htm.push('<td>' + item.title + '</td>'); htm.push('<td>' + item.md + '</td>'); htm.push('</tr>'); }); htm.push('</table>') document.body.innerHTML = htm.join(''); } view(v1);