SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Mar 2003
    Location
    Greensboro, NC
    Posts
    15
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Making Table Row Clickable, with unclickable column

    Hi guys,

    here's what I'm facing. I want to make a table row clickable. But when I do this, if there is a hyperlink or checkbox in the table row, when you click on either of these it performs a "table row" click as well. When clicking in either of these two columns it should not perform a table row click.

    Can anyone provide any guidance?? Here's my table row click code: (I use prototype)

    Code:
      if (!document.getElementsByTagName) return false;
      var rows = $$('tbody.scrollable tr');
      for (var i=0; i < rows.length; i++) {
       rows[i].onmouseover = function () { $(this).addClassName('highlight'); }
       rows[i].onmouseout = function () { $(this).removeClassName('highlight'); }
       rows[i].onclick = function () { Registry.selectRow(this); }
      }
    Thanks for the help in advance!
    -David
    Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
    --Rich Cook

  2. #2
    SitePoint Member
    Join Date
    Mar 2003
    Location
    Greensboro, NC
    Posts
    15
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Spoke too soon. I've worked on this for 2 days, and it just clicked with me...

    I changed this:

    Code:
       rows[i].onclick = function () { Registry.selectRow(this); }
    to this:

    Code:
       rows[i].onclick = function (event) { 
           if ($(event.target).hasClassName('notselectable') {}
           else Registry.selectRow(this); 
       }
    And it performs how I would like it to

    Thanks for looking anyway! Hope this helps someone else later on.
    -David
    Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
    --Rich Cook


Bookmarks

Posting Permissions

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