SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast
    Join Date
    Mar 2004
    Location
    Farmington
    Posts
    80
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    DOM method issue in Firefox

    The following code is working fine in IE but not in Firefox.

    var col1 = parent.document.getElementsByTagName("LI");
    col1['ulitem0_0'].className = "inactivetab";

    In firefox, I am getting error 'col1.ulitem0_0 is undefined'. How do I resolve this error ?

  2. #2
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,237
    Mentioned
    194 Post(s)
    Tagged
    2 Thread(s)
    Is the tag name "LI" or "li"?

  3. #3
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,729
    Mentioned
    104 Post(s)
    Tagged
    4 Thread(s)
    Apparently, the case doesn't matter.

    From: https://developer.mozilla.org/en/DOM...mentsByTagName
    When called on an TML document, getElementsByTagName() lower-cases its argument before proceeding.
    The problem is more likely to be related to a cross-window issue, involving the parent.document.

    Suggestion: Can you move the scripting to the parent window, and have the child window only call the parents scripting function?
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  4. #4
    SitePoint Zealot
    Join Date
    May 2009
    Location
    Netherlands
    Posts
    189
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    col1[parent.window['ulitem0_0']].className = "inactivetab";


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
  •