js obtained by id element is the null value obtained

This is because the page is loaded from the down, js code is written in the head, but to get an element not yet exist, so the first implementation of a null value when acquired id of js statement obtained.

Solution: According to the rules web 1 from the load down, the corresponding js code can be written after the corresponding element id.

     2. Using the function, in order to function, the other page load again performed, this time can be acquired element.

Guess you like

Origin www.cnblogs.com/jayrocking/p/11729688.html