admin管理员组文章数量:1208153
I've created cells for a dynamic table in html page using "document.createElement('td')" method & now wish to set width of each individual cell with some different value. Tried "cell.width = width" but it didn't work.
how can I achieve it?
I've created cells for a dynamic table in html page using "document.createElement('td')" method & now wish to set width of each individual cell with some different value. Tried "cell.width = width" but it didn't work.
how can I achieve it?
Share Improve this question asked Jan 18, 2013 at 8:59 user1976456user1976456 611 gold badge1 silver badge4 bronze badges 4 |2 Answers
Reset to default 12Use style.width
:
var cell = document.createElement('td');
parent.appendChild(cell);
cell.style.width = '200px';
Here is an example.
To post my comment as an answer:
Use cell.style.width = width;
.
本文标签:
版权声明:本文标题:html - how to set cell width in javascript just after creating it with 'document.createElement()' method? - Stac 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1738674251a2106161.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
cell.style.width = width
? Welcome to SO! – 11684 Commented Jan 18, 2013 at 9:01