PDA

View Full Version : Table cell not taking CSS effect



webdeveloper
07 Jul 2010, 04:42 AM
Hi,

I am trying out an experiment here:



<html>
<head>
<style>
#tableContent td.cellClass
{
background : red;
font-size : smaller;
font-weight : bold;
}
</style>
</head>
<body>
<div id="tableContainer"><table id="tableContent"></table></div>

<script type="text/javascript">
var row, cell;
var tableContainer;
var tableContent;

tableContainer = document.getElementById('tableContainer');
tableContent = document.getElementById('tableContent');

row = tableContent.insertRow(0);
cell = row.insertCell(0);
cell.innerHTML = "Test Cell";
cell.class = "cellClass";
</script>
</body>
</html>


The table cell don't seems to take effect of the CSS style.
Any idea guys?

webdeveloper
07 Jul 2010, 05:08 AM
duh, cell.className. :D