插入
无法换行
for (var i = 0; i < tpaths.page.recordCount; i++) {
var arr = tpaths.attractionsList[i];
// 加入复选框
var checkBox = document.createElement("input");
var br = document.createElement("br");
checkBox.setAttribute("type", "checkbox");
checkBox.setAttribute("id", arr.id);
checkBox.setAttribute("name", "checkbox");
checkBox.setAttribute("title", arr.title);
var td = document.createElement("td");
td.appendChild(checkBox);
td.appendChild(document.createTextNode(arr.title));
tr.appendChild(td);
tr.appendChild(br);
}
var arr = tpaths.attractionsList[i];
// 加入复选框
var checkBox = document.createElement("input");
var br = document.createElement("br");
checkBox.setAttribute("type", "checkbox");
checkBox.setAttribute("id", arr.id);
checkBox.setAttribute("name", "checkbox");
checkBox.setAttribute("title", arr.title);
var td = document.createElement("td");
td.appendChild(checkBox);
td.appendChild(document.createTextNode(arr.title));
tr.appendChild(td);
tr.appendChild(br);
}
...全文
请发表友善的回复…
发表回复
守其正 2016-09-13
- 打赏
- 举报
<br />这才是换行吧
挨踢直男 2016-09-13
- 打赏
- 举报
怎么把br插到tr下面去了
tr下面插的是td
ji510434563 2016-09-13
- 打赏
- 举报
tr.appendChild(br);不能这么写 这样跑到tr里面去了