Αναζήτηση στην υποστήριξη

Προσοχή στις απάτες! Δεν θα σας ζητήσουμε ποτέ να καλέσετε ή να στείλετε μήνυμα σε κάποιον αριθμό τηλεφώνου ή να μοιραστείτε προσωπικά δεδομένα. Αναφέρετε τυχόν ύποπτη δραστηριότητα μέσω της επιλογής «Αναφορά κατάχρησης».

Learn More

DOM array "anchors" contains anchors with "name" attribute only, not those with "id" attribute, in contrast to IE-8.

  • 1 απάντηση
  • 1 έχει αυτό το πρόβλημα
  • 1 προβολή
  • Τελευταία απάντηση από cor-el

more options

Trying to list all anchors of a web page that used (somewhat inconsistently) "id" and "name" as identifiers of anchors, I noticed that Firefox misses the anchors with "id = ...", whereas IE-8 lists all of them correctly. Can this be fixed or circumvented?

Trying to list all anchors of a web page that used (somewhat inconsistently) "id" and "name" as identifiers of anchors, I noticed that Firefox misses the anchors with "id = ...", whereas IE-8 lists all of them correctly. Can this be fixed or circumvented?

Όλες οι απαντήσεις (1)

more options

See https://developer.mozilla.org/en/DOM/document.anchors

A possibility is to use document.getElementsByTagName("A") and check for a name and id:

 A=(a.name)?a.name:(a.id)?a.id:''; if(A){T+=A+'<br>'}

Τροποποιήθηκε στις από το χρήστη cor-el