View Full Version : Possible to create TH element using insertCell?

12-13-2004, 05:33 PM
It appears that using the insertCell method to append a cell to a table row in the tbody creates a data cell by default. I need to create a header cell (in the tbody, not in the thead). Is this possible?

The desired result would be something like this:

<th>#text</th> <-- I am unable to create this element.

12-13-2004, 10:43 PM
It doesn't look like it. You'll have to createElement.

12-16-2004, 10:48 AM
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Style-Type" content="text/css">
<meta http-equiv="Content-Script-Type" content="text/javascript">
<script language="JavaScript" type="text/JavaScript">
function createTh(){
var root= document.getElementById('tab').getElementsByTagName('tr')[0];
var eTh = document.createElement('th');
var eTxt = document.createTextNode('#text');
var ref = root.getElementsByTagName('td')[0];
<table id="tab">

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum