How do I iterate nameless elements

I'm programming an application that displays a list of selected database tulips with some restriction in information due to simplicity in the list. However I got a request to enable an option to "expand" every row, displaying the "short description" of the tulip. Easy enough. Now, when a user select a table row it displays the complete information in another frame and sets the row to selected. This works fine with one row, but with the expanding row I've encountered problems. With my current scipt I only select the first row.
Here's an example:

<tr onmouseover="className='highlight_row';" class="e_r" onmouseout="m_ou(this,'e_r');"onclick="cli(this,'e_r',99,'all');">
      <td width="15" style="padding-left: 2px;">&nbsp;</td>
      <td nowrap>Company name</td>
      <td nowrap>Contract description</td>
      <td align="right"><img title="Copy to clipboard" onclick="cli_copy(99);" height="12" src="../images/copy.gif" width="12">&nbsp;</td>
<tr class='e_r'>
      <td colspan='3'>Expanded description using 3 columns.</td>

Without the expanded row the last TR is not executed.
I realize I might be able to work around this by putting it all into a table in each row in the main table, but my curiousity drives me to see if there is a way to solve this. The javascript function works as follow atm:
function cli(t,r,ci,op)
      -[data removed]-

So, how do I set both rows to selected (and deselect them when a new one is set)?

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Not fully sure if this is applicable for your situation, but you should be able to use something like this:

<style type="text/css">
tbody.closed tr.whenOpened {display:none;}
tbody.opened tr.whenClosed {display:none;}

<tbody class="closed">
     <td>This row is always visible</td>
     <td><a href="#" onclick="this.parentNode.parentNode.className='opened';" class="whenClosed">Expand</a></td>
   <tr class="whenOpened">
      <td colspan="2">Detailed description, only visible when tbody class equals 'opened'</td>
<tbody class="closed">
   <!-- another record -->

This way you don't have to mess with div ids and stuff. Also there can be multiple records be opened at the same time.

Hope this helps.



Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
CycnoABAuthor Commented:
That was a very interesting piece of code I must admit.
What is the tbody entity you use? Does it work with table, the one I'm accustomed to? Because i tried and nothing happens (used IE and FF).

My problem pretty much comes down to changing class of the following TR class, so I guess I could change the name of the second one. I found a function called nextSibling which works out fine in IE, but not in FF. Is there a similat function to parentNode? Like nextNode or something like that?
<tbody>,<thead>,<tfoot> are table tags using which you can group tr's.

You can have a single thead, multiple tbodys and single tfoot.

CycnoABAuthor Commented:
What's the pro:s of using them?
Are there any requirements to use them btw, since it's not working for me?
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.