How to use window.onload

一个新手
Release: 2017-10-11 09:11:02
Original
3070 people have browsed it


Let’s learn about the use of window.onload based on the case

Case 1

      
      

1

2

3

4

Copy after login

In this case, if you put js in window.onload An error will be reported inside.
How to use window.onload
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.

Case 2

  111  
 

Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!