Get cells from a row

Last post 05-19-2005 11:26 PM by senselessfeats. 2 replies.

Sort Posts:

  • Get cells from a row

    05-19-2005, 8:07 AM
    • Contributor
      6,321 point Contributor
    • anzer
    • Member since 10-19-2004, 4:00 AM
    • UAE
    • Posts 1,279
    Hi
    I want to change every items in a row to hyperlink when a user clicks the row.
    I am handling the click function in client side and i get the row in Javascript but
    I dont know how to get each cells from this row object.
    I want to iterate through each cells of this row and change them into hyperlink
    please help...

    Anz

    If this post was useful to you, please mark it as answer.

    ClientSideAsp.Net | Blog
  • Re: Get cells from a row

    05-19-2005, 9:38 AM
    • All-Star
      20,674 point All-Star
    • A1ien51
    • Member since 05-06-2005, 6:46 PM
    • MD USA
    • Posts 3,803

    I posted the code on my blog since I really hate posting code here on the forum!

    http://radio.javaranch.com/pascarello/2005/05/19/1116509823591.html

    Hope that is what you were after.

    Eric

  • Re: Get cells from a row

    05-19-2005, 11:26 PM
    You can try this:

    var oRow // your row object

    var strContent = ""
    var sHTML = ""
    for (var j = 0; j < oRow.cells.length; j++)
    {
        strContent = oRow.cells[j].innerText
        sHTML = "<a href=\"yourURL\">" + strContent + "</a>"
        oRow.cells[j].innerHTML = sHTML;
    }


    > penny for a thought
Page 1 of 1 (3 items)