Javascript 将HTML添加到表格单元格-IE的问题
我正试图构造一个表。下面是我正在使用的代码的一个小片段Javascript 将HTML添加到表格单元格-IE的问题,javascript,jquery,internet-explorer,html-table,Javascript,Jquery,Internet Explorer,Html Table,我正试图构造一个表。下面是我正在使用的代码的一个小片段 this._head = $({tag: 'thead', style: {align: 'center'}, html: "<th>" + this._eachCol(function(c) { return c.title; }).join('</th><th>') + "</th>"}); this._table = $({tag: 'table', parent: this._el,
this._head = $({tag: 'thead', style: {align: 'center'}, html: "<th>" + this._eachCol(function(c) { return c.title; }).join('</th><th>') + "</th>"});
this._table = $({tag: 'table', parent: this._el, style: {clear:'both', align: 'center'}, className: 'data_table', children: [this._head], attrs: {cellSpacing: 0, cellPadding: 0}});
this._body = $({tag: 'tbody', parent: this._table});
注意:我首先分配或设置表头,因为IE在设置或重置表中已有元素的html时遇到问题。生成的html是什么样子的?@GraphicsDive:添加了代码。“救命?”纳夫尼特:不,看起来不错。可能只是造型问题。尝试剥离所有的CSS和样式,看看这看起来是否更合理。谢谢你的回复。剥离css可能会破坏其他浏览器的功能。或者我没有理解你的意思…@Navneet-我不是说这是一个解决方案,只是一种探索问题的方式。
<table cellspacing="0" cellpadding="0" style="clear: both; " class="data_table">
<thead>
<tr><th>Date</th><th>Time</th><th>Credits Earned</th><th>How Earned</th><th>Distance</th><th>Credits Spent</th></tr>
</thead>
<tbody>
<tr class="row_even"><td>20 Jan, 2012</td><td>1:51AM</td><td>680</td><td>Spin</td><td>0</td><td>1175</td></tr>
</tbody>
</table>