One JavaScript instance every day-get the current height of the element, javascript instance
<! DOCTYPE html>
Element Acquisition in javascript
Id is unique, that is, an id of the same name is not allowed to exist on the same page. Therefore, when an id is used to obtain a webpage element, a single element is obtained, not an array, therefore, you do not need to add [0], for example:
GetElementById ("abc ")
The names or tagnames allow the same name. Therefore, the webpage elements obtained through them are arrays (even if the same name does not exist, only one is an array ), to call one of the elements, such as the first one, you must add [0]. For example:
GetElementsByName ("kkk") [0]
GetElementsByTagName ("kkk") [0]
In fact, from the front of By, you know which one needs to be added [0] and which does not need to be added.
In addition, your getElementByTagName is incorrect, with a missing s
Element Acquisition using javascript
If getElementByTagName does not have this method, it should be getElementsByTagName.
GetElementsByTagName returns an array
[0] should be added, but in javascript, sometimes the array itself can also represent the first element of the array.
But this is not a good habit! [0]