Jump to content

Kennys

Members
  • Posts

    3
  • Joined

  • Last visited

Kennys's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. Not really I think. This is basically my 2nd solution.Based on some criterion I want to show 0, 1, or some of the <tr>s.The criterion is something which should not show on the screen, but is part of the <tr>.In my 2nd solution I indeed do use innerHTML to get the string"<!-- id="a" -->...."Then I extract with some substring-guru-stuff the "a" or "b" to decide whether to show or hide the <tr>. But this depends on the exact layout of the comment.What I want to do is something like:<table><tr userdata="a">...</tr><tr userdata="a">...</tr><tr userdata="b">...</tr>...</table>But thats not HTML The nearest to that is using the id attribute, see solution 1).But that's (I think) mis-using the id attribute.So I wonder if there's a general way to add some user-defined attribute to an element (any element, not just <tr>, btw) that does not influence HTML in any way, but that can be extracted in JavaScript using the DOM...The Dutch word 'dom' means 'stupid', btw Thanks for bearing with me....Martijn
  2. Hi,I'm building an (X)HTML application which uses a lot of JavaScript.One of the things I want to do is to shown/hide specific <tr> elements using JavaScript. How to do that is not the problem.But to decide which rows to show I need some attribute in the <tr> element.I've figured out 2 idea's, both not very ideal I think:1)<table> <tr id="a">...</tr> <tr id="a">...</tr> <tr id="b">...</tr> ...</table>Now hide all <tr>s with id="a" (for example).Note: id's are not unique now (and not intended for this purpose?).2)<table> <tr><!-- id="a" -->...</tr> <tr><!-- id="a" -->...</tr> <tr><!-- id="b" -->...</tr> ...</table>In JavaScript I can reach the comment via innerHTML to decide whether to show the <tr> or not.Which method is the "prefered" one? Is there a better way?Martijn
×
×
  • Create New...