This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes dynamically change the width of table cell(td) thorough java script Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "dynamically change the width of table cell(td) thorough java script" Watch "dynamically change the width of table cell(td) thorough java script" New topic
Author

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

fahad nizamani
Greenhorn

Joined: Nov 19, 2011
Posts: 7
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

Joined: Nov 08, 2001
Posts: 15376
    
    6
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: dynamically change the width of table cell(td) thorough java script
 
Similar Threads
how to integreate with java and mssql reporting service
Event Firing for change in the JTable
creating a database table
Get Cell Values from HTML Table Using Servlet
onchange for dynamically added rows