944,082 Members | Top Members by Rank

Ad:
Oct 22nd, 2009
0

Table id

Expand Post »
I have a table, and insde the table dynamic inputtextboxes

how can i set the id of textbox "row" + row number

id of first textboxt row0, second one row1 and so on..
Similar Threads
Reputation Points: 10
Solved Threads: 0
Junior Poster
hajjo is offline Offline
101 posts
since Mar 2008
Oct 22nd, 2009
0
Re: Table id
Show us your code otherwise we're just guessing
Sponsor
Reputation Points: 520
Solved Threads: 268
Code Monkey
ShawnCplus is offline Offline
1,564 posts
since Apr 2005
Oct 22nd, 2009
0
Re: Table id
javascript Syntax (Toggle Plain Text)
  1. function getId() {
  2. var table = document.getElementById('your-table-id');
  3. var rows = table.getElementsByTagName('tr');
  4. var newId;
  5. if(rows && rows.length) {
  6. var lastRowId = rows[rows.length-1].id;
  7. newId = 'row' + parseInt(lastRowId.substring(lastRowId.indexOf('row')+1, lastRowId.lendth)) + 1;
  8. } else {
  9. newId = 'row0';
  10. }
  11.  
  12. return newId;
  13. }
Reputation Points: 83
Solved Threads: 61
Posting Pro in Training
Luckychap is offline Offline
442 posts
since Aug 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in JavaScript / DHTML / AJAX Forum Timeline: CSS drop down menu problems
Next Thread in JavaScript / DHTML / AJAX Forum Timeline: What's the difference..?





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC