Dynamically created rows in table are not following the StyleSheetrules

R

Raghuram Banda

Hi all,

I've created a table with Table Header and the table may or may not
contain any rows initially.
I've included a .css file in <head> section of my HTML script and I'm
creating rows to the table
dynamically using JavaScript (using DOM), and the problem is those
created bby DOM are not
following style sheet rules applicable for table rows and cells. But the
rows created from within
HTML script are following style sheet rules. The following is sample
which is used to create
dynamic row.

this.table = document.getElementById(tableId);
currentTb = document.createElement("TBODY");
currentRow = document.createElement("TR");
currentCell = document.createElement("TD");
currentElement = document.createTextNode("text");
currentCell.appendChild(currentElement);
currentElement = document.createElement("input");
currentElement.setAttribute("type", "text");
currentElement.setAttribute("name", "textBoxName");
currentElement.setAttribute("id", "textBoxId");
currentElement.setAttribute("size", "8");
currentCell.appendChild(currentElement);
currentElement = document.createElement("input");
currentElement.setAttribute("type", "checkbox");
currentElement.setAttribute("name", "checkBoxName");
currentElement.setAttribute("id", "checkBoxId");
currentElement.setAttribute("value", "t");
currentCell.appendChild(currentElement);
currentRow.appendChild(currentCell);
currentTb.appendChild(currentRow);
this.table.appendChild(currentTb);

Sorry for long mail

Thanks in advance
Raghuram Banda
 
K

kaeli

And on the day Fri, 07 Nov 2003 05:31:10 GMT,
(e-mail address removed) enlightened us with <y6Gqb.2047$g4.45509
@news2.nokia.com>...
Hi all,

I've created a table with Table Header and the table may or may not
contain any rows initially.
I've included a .css file in <head> section of my HTML script and I'm
creating rows to the table
dynamically using JavaScript (using DOM), and the problem is those
created bby DOM are not
following style sheet rules applicable for table rows and cells. But the
rows created from within
HTML script are following style sheet rules. The following is sample
which is used to create
dynamic row.

currentTb = document.createElement("TBODY");

If the table is already created, this might be mucking things up. I'm
not sure, but try creating the tbody with the table header instead of
via script. This might somehow be creating a second tbody.

Just a thought.


--
--------------------------------------------------
~kaeli~
Winerr 01C - Wrong Disk Formatted. Sorry About That.
Winerr 01D - Enter any 11-digit prime number to continue.
http://www.ipwebdesign.net/wildAtHeart/
http://www.ipwebdesign.net/kaelisSpace/
------------------------------------------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top