SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Member
    Join Date
    Oct 2007
    Posts
    21
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    problem with document.anchors.length in mozilla.

    problem with document.anchors.length in mozilla.
    i am traversing through the anchors in the document and clicking the desired one programatically using the method "onclick()".
    its working fine in IE but document.anchors.length is zero in Mozilla.
    my code looks like this:

    for(i=0;i<document.anchors.length;i++){
    if(check condition){
    particular anchor.onclick();
    }
    }
    In Mozilla, document.anchor.length is zero.
    why is it so..?
    can anybody help me out of this..?

    Thanks in advance
    Durga prasad.

  2. #2
    Guru in training bronze trophy SoulScratch's Avatar
    Join Date
    Apr 2006
    Location
    Maryland
    Posts
    1,838
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    document.getElementsByTagName('a').length

  3. #3
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,684
    Mentioned
    100 Post(s)
    Tagged
    4 Thread(s)
    And while you're doing that you may want to check for the href attribute, because you wouldn't want to do anything with a named anchor by accident.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  4. #4
    SitePoint Member
    Join Date
    Oct 2007
    Posts
    21
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by SoulScratch View Post
    document.getElementsByTagName('a').length
    Thanks SoulScratch..
    my problem is solved.thanks for ur quick reponse..

  5. #5
    SitePoint Member
    Join Date
    Oct 2007
    Posts
    21
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by pmw57 View Post
    And while you're doing that you may want to check for the href attribute, because you wouldn't want to do anything with a named anchor by accident.
    ya.. i am doing similar to it..but anyways my problem is solved..
    thanks for ur response...


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
  •