How to access node objects in JavaScript How to use _javascript techniques

Source: Internet
Author: User
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>
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.