What are the methods of accessing node objects in JavaScript?
Copy Code code 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>