Home  >  Article  >  Web Front-end  >  JavaScript事件委托用法分析_javascript技巧

JavaScript事件委托用法分析_javascript技巧

WBOY
WBOYOriginal
2016-05-16 16:18:111012browse

本文实例讲述了JavaScript事件委托用法。分享给大家供大家参考。具体分析如下:

一、点击页面任何部分触发事件

创建一个script1.js文件。

复制代码 代码如下:
(function() {
    eventUtility.addEvent(document, "click", function(evt) {
        alert('hello');
    });
}());

页面部分。

复制代码 代码如下:


   


   
   
   

Statement:
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