Stan Kaczmarczyk

Navigation

Skip navigation.

Search

Site navigation

Email conversation

FromStan Kaczmarczyk
ToMe
Subjectdocument.anchors collection in firefox
Date23 February 2005 21:43
Hi I was just wandering if you by any chance have come across this
potential bug ... Whever i try to access the document.anchors.length
property and find out how many 
anchors are present in the doc i get 0 (eventhough there are quite a
few) ... the a tags i'm looking for are created through dom ... the
weird thing is it worx flawlessly in explorer ... firefox always returns
0... (even if there are tags that were created  in normal html) ... any
thoughts ?
 
 
thanx for any suggestions
 
Stan Kaczmarczyk
FromMe
ToStan Kaczmarczyk
SubjectRe: document.anchors collection in firefox
Date26 February 2005 11:47
Stan,

Never seen this sort of bug in Firefox. In the tests I just did now, they
all got it correct if I used HTML, and if I used DOM, Firefox, Opera,
Safari, Konqueror, etc got it correct, and IE (5.5) said 0.

<body>
<script>
x=document.createElement('a');
x.setAttribute('name','foo1')
document.body.appendChild(x);
x=document.createElement('a');
x.setAttribute('name','foo2')
document.body.appendChild(x);
alert(document.anchors.length)
</script>

What do other standards compliant browsers (like Opera) say?


Mark 'Tarquin' Wilton-Jones - author of http://www.howtocreate.co.uk/
FromStan Kaczmarczyk
ToMe
Subjectdocument.anchors collection in firefox
Date7 March 2005 16:33
Thanx for your reply , Mark ... Unfourtunately I didn't have any time to
test out my script in anything else than explorer and fire fox ... I
ended up using documents.links collection.. I suspect that the anchors
collection (in firefox at least) refers to anchors on the same page ,
not all a elts...  Once again I had no time to confirm that ..i'll c if
I can play around with it this weekend and let you know what happens ...


Stan Kaczmarczyk
This site was created by Mark "Tarquin" Wilton-Jones.
Don't click this link unless you want to be banned from our site.