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

Generate Table and attributes at runtime

100+
P: 101
Hi,

I have to generate a DOM table Run time but how can i generate it's attribute like name and id etc.


Please Help,

Regards,
Oct 31 '07 #1
Share this Question
Share on Google+
2 Replies


acoder
Expert Mod 15k+
P: 16,027
What do you mean by generate? Do you want to give it a unique name and id?

You could keep a global variable or use the table row number.
Oct 31 '07 #2

dmjpro
100+
P: 2,476
Hi,

I have to generate a DOM table Run time but how can i generate it's attribute like name and id etc.


Please Help,

Regards,

Expand|Select|Wrap|Line Numbers
  1. var tab_ref = document.createElement('TABLE');
  2. tab_ref.setAttribute('name','some_name');
  3. ...
  4. ...
  5. parent_ref.appendChild(tab_ref); //add the element to parent node
  6.  
Debasis
Oct 31 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.