Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
Seeking advice. innerHTML and Tables
Old 07-08-2012, 11:20 PM Seeking advice. innerHTML and Tables
Extreme Talker

Posts: 193
Name: James
Location: Australia
Trades: 0
I want to replace or create the table rows in the tbody section of a table, and I am trying to use innerHTML to do that.


Having done a quick googlesearch, I understand I am not meant to use innerHTML with tables.


How is the best way to replace or insert rows in a table using AJAX etc.?
__________________
** Directory of my other websites ***

Please login or register to view this content. Registration is FREE
- for screen devices

Please login or register to view this content. Registration is FREE
- for mobile devices
TRANZIT JIM is offline
Reply With Quote
View Public Profile Visit TRANZIT JIM's homepage!
 
 
Register now for full access!
Old 07-09-2012, 09:55 AM Re: Seeking advice. innerHTML and Tables
chrishirst's Avatar
Defies a Status

Posts: 43,959
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Use the DOM Table object

The cells collection is an associative array where the cell ID or name plus innerHTML make up the key/value pairing.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 07-09-2012, 09:31 PM Re: Seeking advice. innerHTML and Tables
Extreme Talker

Posts: 193
Name: James
Location: Australia
Trades: 0
It all looks so complicated.

I have since gone for inserting span elements.

However, I may have a go at it later.
Thanks anyhow for the link.
__________________
** Directory of my other websites ***

Please login or register to view this content. Registration is FREE
- for screen devices

Please login or register to view this content. Registration is FREE
- for mobile devices
TRANZIT JIM is offline
Reply With Quote
View Public Profile Visit TRANZIT JIM's homepage!
 
Old 07-09-2012, 09:59 PM Re: Seeking advice. innerHTML and Tables
Physicsguy's Avatar
404 - Title not found

Posts: 1,060
Name: Scott Kaye
Location: Ontario
Trades: 0
By the looks of it, it's pretty easy. insertRow() is a function, so you all you have to do is call it on your table. Check out the tryit for it, it works really well and is very easy to use!
__________________

Please login or register to view this content. Registration is FREE
Physicsguy is offline
Reply With Quote
View Public Profile Visit Physicsguy's homepage!
 
Old 07-10-2012, 06:59 AM Re: Seeking advice. innerHTML and Tables
chrishirst's Avatar
Defies a Status

Posts: 43,959
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Quote:
I have since gone for inserting span elements.
It is actually no more difficult than what you have done by inserting spans, the principle is exactly the same, it is simply the parent location that differs.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Reply     « Reply to Seeking advice. innerHTML and Tables
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.18106 seconds with 11 queries