Thursday, June 25, 2009

Take care of letter case when specifying colSpan attribute in javascript




Normally we specify colspan attribute for <td> tag.

For example
<table>
<tr>
<td colspan=”2>QualityPointTechnologies </td>
</tr>
</table>


We can create the above design using javascript in a following way
<script language=”javascript>
table = document.createElement(“table”);

row = document.createElement(“tr”);

cell = document.createElement(“td”);
cell.colSpan=”2”; // colSpan specify ‘S’ as capital letter other wise it won’t work
cell.innerHTML=” QualityPointTechnologies”;

row.appendChild(“cell”);
table.appendChild(“row”);
</script>


We should specify the "S" in Upper case in the colspan, otherwise it won't work.

More Articles...

1 comment:

Reverse Cell Phone Directory said...

Thanks, some great tips, I have such a long way to go with HTML...

Search This Blog