The common methods in the following three types of JS are getElementById (), Getelementsbyname (), and getElementsByTagName (), whose role is to return a single node or a collection of nodes by id attribute, name attribute/tag name, respectively.
getElementById Gets the ID name, a page must be unique as an instance
var AA = getElementById (' input '). Value;alert (AA); Result is AAAA
<input id= ' input ' value= ' aaaa '/>
function GetValue () {
var X=document.getelementbyid ("MyHeader");
alert (x.innerhtml);
}
Getelementsbyname is to obtain name= ' CCC ';
var c= getelementsbyname (' input '). Value;alert (AA); Result is AAAA
<input id= ' input ' value= ' aaaa '/>
getElementsByTagName Get page All tags like class head title so here's not
function Dogetelementsbytagname () {
var x=document.getelementsbytagname ("input");
alert (x.length);
}