我想动态创建一个表,其中一些表具有指向其他带有循环的 url 的链接,请注意:在每个表中,我正在填充动态 html,该 html 具有从数组填充的动态值。我的代码如下所示。当我运行这段代码时,js返回一个数组“unexpected tocken 'for'”,我用while也试过了..错误又是一样的。帮我解惑。。
html += '<tr class="' + (i % 2 == 0 ? 'grid_color' : '') + '" data-type="record" data-record-id="' + records[i].id + '" data-row-index="' + i + '">'
+ '<td data-table-col="16" title="' + Samples.htmlEntities(records[i].name_id) + '">' +
for (i = 0; i < nameSplit.length; i++) {
if (nameSplit[i] != "None") {
name = nameSplit[i].split(".");
name = name.shift();
'<a target = "_blank" href="http://www.google.com/' + name + '">' + name.substr(0, 10 / nameSplit.length) + (name.length > 10 / nameSplit.length ? '...' : '') + '</a>'
} else {
if (i != nameSplit.length - 1) {
"|";
}
} else {
if (i != nameSplit.length - 1) "None".concat("|");
else "None";
}
}
}
'</td>'