In this case, if you put js in window.onload An error will be reported inside.
Analysis: The js placed in onload will wait for the html to be loaded before executing the function, but when loading the html, there isonclick="btn('box1')"
, this function will not be found (because the function has not been loaded at this time). To call this function, it must be loaded.
The above is the detailed content of How to use window.onload. For more information, please follow other related articles on the PHP Chinese website!