javascript-getelement
what type of values given to get开发者_高级运维ElementById() method
getElementById
expects a string.
The following code:
var element = document.getElementById('myId');
finds the following element and assigns it to element
<div id="myId"></div>
just pass the id of any element
like <input type="text" id="text" />
just use getElementById("text")
a single DOM object, of a specialized class depending on the nature of the element identified by the given ID
精彩评论