Because there are always novice friends to ask this question, so the cloud-Habitat community small compilation of methods needed friends.
In simple terms: Table single value, insert character with innerHTML
such as <input type= "text" value= "" id= "jb51"/>
A label with the Value property can be usedgetElementById("jb51").value
Like <div id= "jb51" >12345</div>
This label without the value attribute is usedgetElementById("jb51").innerHTML
You use document.getElementById () to get to the page with an ID element
And then access the attributes of this element, such as value
When an element has a value attribute, its values are valued
Example 1
<input type= "text" id= "txt1" value= "Hello"/>
Such an element, when you use document.getElementById ("Txt1"). Value, you can get its value, that is, "hello" this string.
If an element has no value, then the document.getElementById () value is not available. It is taken for granted that there is no such thing as how to access?
A div tag, for example, does not necessarily have a value.
InnerHTML
This refers to what is in the element
Example 2
An element has a start tag and an end tag such as
<label id= "LB1" >this is a label</label>
When you use document.getElementById ("LB1"). innerHTML can take the content between <label> and </label>, that is, ' this is a label '.