-
addEventListener(eventType,listener,useCapture)
eventType参数指定handle类型,如”click”,”mouseover”,”keydown”等。
listener参数是函数或者内联函数的引用,传递handle处理的闭包。
最后一个参数,useCapture是个布尔型变量,一般留为空。
<html> <head> <title>DOM Level 2 Events Example</title> <script type="text/javascript" src="../scripts/jquery-1.2.1.js"> </script> <script type="text/javascript"> $(function(){ var element = $('#vstar')[0]; element.addEventListener('click',function(event) { say('Whee once!'); },false); element.addEventListener('click',function(event) { say('Whee twice!'); },false); element.addEventListener('click',function(event) { say('Whee three times!'); },false); }); function say(text) { $('#console').append('<div>'+text+'</div>'); } </script> </head> <body> <img id="vstar" src="vstar.jpg"/> <div id="console"></div> </body> </html>
Establishes three event handlers!
相关推荐
Javascript Event Handlers
flexpaper_handlers.jsflexpaper_handlers.jsflexpaper_handlers.js
Throughout this part we will, among other things, learn how to test code that depends on browser API’s, timers, event handlers, DOM manipulation, and asynchronous server requests (i.e., “Ajax”)....
handlers.js
4 Multiple Event Handlers: Two’s Company 139 5 Asynchronous Applications: It’s Like Renewing Your Driver’s License 173 6 The Document Object Model: Web Page Forestry 229 7 Manipulating the DOM: My ...
总结了IE 5 ,页面的所有事件 Dom Event Handlers/Dom 事件处理函数
2. Lexical Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 2.1 Character Set 21 2.2 Comments 23 2.3 Literals 23 2.4 ...
JavaScript Applications with Node.js, React, React Native and MongoDB: Design, code, test, deploy and manage in Amazon AWS By 作者: Eric Bush ISBN-10 书号: 0997196661 ISBN-13 书号: 9780997196665 出版...
资源分类:Python库 所属语言:Python 资源全名:django-ohm2-handlers-light-0.1.19.tar.gz 资源来源:官方 安装方法:https://lanzao.blog.csdn.net/article/details/101784059
var handlers = require ( 'react-handlers' ) ; render = function ( ) { return < button onClick = { handlers ( this . doThis , this . doThat ) } > Clack < / button > } 触发事件时,将按顺序...
What you’ll learn: Which parts of promises are synchronous and which are asynchronous How to effectively use promise chains to simplify ...What happens to rejected promises without rejection handlers
Chapter 3, Axis2 XML Model (AXIOM) - Learn about the heart of a web service framework and learning more about XML processing in Axis2. Chapter 4, Execution Chain - Learn how to extend the core ...
this reference alphabetically lists every HTML tag supported by Netscape Navigator and Internet Explorer, along with their attributes, event handlers, CSS and JavaScript style properties, and much ...
开源项目-gorilla-handlers.zip,gorilla/handlers: A collection of useful handlers for Go's net/http package
This means every graphical object you create is also a DOM object, so you can attach JavaScript event handlers or modify them later. Raphaël’s goal is to provide an adapter that will make drawing ...
主要介绍了Python logging模块handlers用法详解,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友可以参考下
资源分类:Python库 所属语言:Python 资源全名:pollination_handlers-0.5.0-py2.py3-none-any.whl 资源来源:官方 安装方法:https://lanzao.blog.csdn.net/article/details/101784059
主要特点: * 可以同时上传多个文件;...在使用SWFUpload之前,请确认你具备一定的JavaScript和DOM知识。在实际开发中,大部分的错误都是由于错误的设置和低劣的Event Handlers处理程序所造成的。
SWFUpload的主要特点 * 可以同时上传多个文件;... 在使用SWFUpload之前,请确认你具备一定的JavaScript和DOM知识。在实际开发中,大部分的错误都是由于错误的设置和低劣的Event Handlers处理程序所造成的。