What are the methods for accessing node objects in JavaScript?
Copy codeThe Code is as follows:
Var obj = document. getElementById ('fdafda ');
Var obj = document. f1;
Obj. method = "post ";
Obj. action = 'bb ';
Var obj = document. f1.userName;
Var obj = document. forms [0]. userName;
Var obj = document. forms [0]. elements [0];
Var obj = document. f1.elements [0];
Var obj = document. forms ["f1"]. elements ["userName"];
Var obj = document. forms [0]. like;
For (var I = 0; I <obj. length; I ++)
{
Var aa = obj [I];
If (aa. checked)
{
Alert ();
}
}
<Form name = "f1" action = "AA">
<Input type = "text" name = "userName" id = "userName"/>
<Input type = "checkbox" name = "like" value = "sport"/>
<Input type = "checkbox" name = "like" value = "art"/>
<Input type = "checkbox" name = "like" value = "music"/>
</Form>
<Form name = "f1" action = "AA">
<Input type = "text" name = "userName" id = "userName"/>
<Input type = "checkbox" name = "like" value = "sport"/>
<Input type = "checkbox" name = "like" value = "art"/>
<Input type = "checkbox" name = "like" value = "music"/>
</Form>
<Form name = "f1" action = "AA">
<Input type = "text" name = "userName" id = "userName"/>
<Input type = "checkbox" name = "like" value = "sport"/>
<Input type = "checkbox" name = "like" value = "art"/>
<Input type = "checkbox" name = "like" value = "music"/>
</Form>