Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Dynamically created rows in table are not following the StyleSheetrules

Reply
Thread Tools

Dynamically created rows in table are not following the StyleSheetrules

 
 
Raghuram Banda
Guest
Posts: n/a
 
      11-07-2003
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

 
Reply With Quote
 
 
 
 
kaeli
Guest
Posts: n/a
 
      11-07-2003
And on the day Fri, 07 Nov 2003 05:31:10 GMT,
http://www.velocityreviews.com/forums/(E-Mail 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/
------------------------------------------------
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Affecting a dynamically created drop down from another dynamically created drop down. msimmons ASP .Net 0 07-16-2009 03:17 PM
Moving dynamically created table rows up and down in an HTML table T.G. Javascript 2 10-14-2008 12:56 PM
Managing ViewState of a dynamically created Custom Composite Server Control -(where the original is also dynamically created) dickster ASP .Net Building Controls 0 12-08-2005 09:32 AM
dynamically add new rows and save data typed in these rows to a database Arjen Hoekstra ASP .Net 0 08-02-2005 12:15 PM
Table/table rows/table data tag question? Rio HTML 4 11-05-2004 08:11 AM



Advertisments