Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Oct 2002
    Posts
    299
    Thanks
    0
    Thanked 0 Times in 0 Posts

    onClick document.getElementById('B+row-number').innerHTML

    Hi,

    Difficult to explane, but i'll give it a try:

    I have a table with one or more rows and 2 columms, one row looks like this:

    <tr id="row-number" onClick=""><td id="a-columm+row-number">some data</td><td id="b-columm+row-number">data used for the onClick event</td></tr>

    Every row has an id which is the row-number
    Every cell has an id which is columm a or b + row-number

    This works fine!

    My question is:

    The onClick event in the - tr - needs to have the data from columm - b - from the same row.

    F.e.

    <tr id="4" onClick="alert('DATA FROM CELL B4: JEROME')"><td id="A4">some data</td><td id="B4">JEROME</td></tr>

    Unfortunately, the easiest way, implement the onClick event in the - td tag - from columm - b - is not possible.

    Another idea, to write the data from columm - b - directly in the onClick event when building the table is also no option.

    Feels like i'am running out of idea's today....
    Thanks for Your effort,
    Jerome

  • #2
    Regular Coder
    Join Date
    Oct 2002
    Posts
    299
    Thanks
    0
    Thanked 0 Times in 0 Posts
    This is NOT the way to go, so I didn't.........

    Jerome

  • #3
    Senior Coder
    Join Date
    Aug 2002
    Location
    UK
    Posts
    2,789
    Thanks
    2
    Thanked 14 Times in 14 Posts
    Is the following any good?



    <table border="1">
    <tr id="row1" onClick="alert(cb_row1.innerText)">
    <td id="ca_row1">Data Data Data Data</td><td id="cb_row1">Information in Row 1 Column b</td>
    </tr>
    <tr id="row2" onClick="alert(cb_row2.innerText)">
    <td id="ca_row2"> Data Data Data</td><td id="cb_row2">More Data in Row 2 Column b</td>
    </tr>
    </table>
    Last edited by Mr J; 04-04-2003 at 11:16 PM.

  • #4
    Regular Coder
    Join Date
    Nov 2002
    Posts
    596
    Thanks
    0
    Thanked 0 Times in 0 Posts
    <html>
    <head>
    </head>
    <body>
    <table align="center" cellspacing="3" border="1" style="cursor&#58;pointer;cursor:hand;">
    <tr id="R4" onclick="alert(this.lastChild.firstChild.nodeValue)">
    <td id="A4">some data</td><td id="B4">JEROME</td>
    </tr>
    </table>
    </body>
    </html>

    http://www.brainjar.com/dhtml/intro/default.asp


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •