Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

dynamically change the width of table cell(td) thorough java script

 
fahad nizamani
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all,

can any one help me, i am generating table rows and table data(cell) dynamically on through java script.
i am unable to change the width of newly created table cell.i have created the cells through insert Cell() function
i tried like this,,

var oCell = new Row.insert Cell(0);
oCell.style.width="2%;"
oCell.innerHTML = "<input type='text' name='name1'>";

but style.width did not work so please any one do me favor. keep in mind i am restricted to use fire fox.


 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First thing is you have the semicolon in the wrong place



should be



Second, if the contents is bigger, the cell will expand to fit it.

Eric
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic