SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Zealot
    Join Date
    Dec 2010
    Posts
    167
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Set src of a childNode?

    My last childnode is an img and is undefined according to firebug.

    Can I do this?

    this.parentNode.parentNode.parentNode.parentNode.previousSibling.childNodes.childNodes.src = "/assets/img/icons/process.png";

  2. #2
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,682
    Mentioned
    99 Post(s)
    Tagged
    4 Thread(s)
    Code:
    ...childNodes.childNodes...
    childNodes returns an array-like collection, so you'll need to pick one of those items if you want to get its own childnodes.

    Code:
    ...childNodes[0].childNodes...
    There's little else that can be advised without knowing much of the HTML that's involved too.
    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
  •