Current location: Hot Scripts Forums » General Web Coding » JavaScript » add a row in a table


add a row in a table

Reply
  #1 (permalink)  
Old 12-09-03, 11:11 AM
paulwynd's Avatar
paulwynd paulwynd is offline
Newbie Coder
 
Join Date: Nov 2003
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Question add a row in a table

Hi!
How can I add a row to a table in DHTML?
I tried with createElement(..) and with t.rows.length=...; but no way!

Thanx for any help!!!
Reply With Quote
  #2 (permalink)  
Old 01-05-04, 06:35 PM
Leanne Leanne is offline
Newbie Coder
 
Join Date: Jan 2004
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Try this... it works for me


var x = document.createTextNode('your text to go in table');
var tbl = document.getElementById('tableID')
tbl.insertRow(0).appendChild(x);

the 0 means that the row will be inserted at the top. You can also leave off the appendChild.

Hope this helps.
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Validator ctrl in table cell : Strange behaviour sunny_doncaster ASP.NET 6 07-31-08 09:43 AM
strange grey "extra" table area... skyraider HTML/XHTML/XML 1 12-10-03 10:55 PM
Looking for a update table script thebugz Script Requests 1 12-07-03 06:32 PM
Auto-emailing on table insert mdhall PHP 5 10-13-03 10:14 AM
moving data from table to table ..please help! geneane ASP 2 09-22-03 07:02 PM


All times are GMT -5. The time now is 11:32 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.