插入
无法换行

lubery 2016-09-13 10:12:57
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);
}
...全文
838 3 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
守其正 2016-09-13
  • 打赏
  • 举报
回复
<br />这才是换行吧
挨踢直男 2016-09-13
  • 打赏
  • 举报
回复
怎么把br插到tr下面去了 tr下面插的是td
ji510434563 2016-09-13
  • 打赏
  • 举报
回复
tr.appendChild(br);不能这么写 这样跑到tr里面去了

87,997

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧