"> Detailed explanation of how javascript creates event definition examples-JS Tutorial-php.cn

Detailed explanation of how javascript creates event definition examples

伊谢尔伦
Release: 2017-07-22 16:13:38
Original
1127 people have browsed it

Common definition method


Copy after login

This is the most common definition method, directly defining the JS event on the required object . The relevant transformation is the form of calling the method, as follows


 
Copy after login

The second one


 
Copy after login

Here defines the operations that occur when loading and unloading windows.

If it is an event for other objects, you only need to modify the value of the for attribute to the object name and event to the monitored event. As follows:


Copy after login

The third type:


 
Copy after login

Here we use the registration form , register the method to the specified event of the specified object. Called using the object name.

The complete test code is as follows:


    无标题文档 
JS很好学
Copy after login

The above is the detailed content of Detailed explanation of how javascript creates event definition examples. 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!