By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,733 Members | 930 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,733 IT Pros & Developers. It's quick & easy.

Dynamically created rows in table are not following the StyleSheetrules

P: n/a
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

Jul 20 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
And on the day Fri, 07 Nov 2003 05:31:10 GMT,
ra************@nokia.sify.net 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/
------------------------------------------------
Jul 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.