Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Getting element access inside div
Message
De
19/10/2017 04:37:58
 
 
À
18/10/2017 17:04:24
Information générale
Forum:
Javascript
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01655076
Message ID:
01655081
Vues:
42
>I have a div which contains some HTML.
>
>I can do this:
>
>
>loElements=loDiv.getElementsByTagName("form")
>
>
>This will contain all the forms.
>
>If I do this:
>
>
>for (lnCounter=0; lnCounter<loElements.length; lnCounter++)
>{
>   alert(loElements[lnCounter].id)
>}
>
>
>...it shows me Form1.
>
>As I only need to access one form, I thought of changing this to:
>
>
>loForm=loDiv.getElementById("Form1")
>
>
>But, this doesn't work. Javascript stops.
>
>Why can't I access it directly with getElementById()?

.getElementById() is only available on the document,,,,
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform