The correct source program is as follows:
;
And if it is placed outside the function abc(), the program will not be able to implement the function.
The reason is as follows: The browser parses the Html page from top to bottom. When parsing btnReg = document.getElementById("btnReg"), the button with the id btnReg has not been parsed, so the global variable btnReg The value is defined,
and because it is only executed once, the program cannot realize the function, and the correct source program is retrieved every second, and the value can be retrieved after the button button is parsed. The program can realize the function.