SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict
    Join Date
    May 2007
    Posts
    242
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Reference Via Xpath

    Hello. For conventional javascript is there any method or function that will let me have a node reference using xpath? The node that I want to create a reference for, is deeply nested inside an xhtml table and there isnt any id attribute to access it easily. And I dont want to create for loops or other time taking methods .Xpath expression is below

    PHP Code:
    /html/body/table[2]/tbody/tr/td/table/tbody/tr[2]/td/table/tbody/tr/td 

    And I am looking for a function that will turn this xpath expression into an javascript reference like below.
    PHP Code:
    document.getElementsByTagName("table")[1].getElementsByTagName(.......... 
    In short, I need to get reference from xpath easily using a function and I hope there is one.

    Thanks in advance.

  2. #2
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,705
    Mentioned
    102 Post(s)
    Tagged
    4 Thread(s)
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript


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
  •