index.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>事件对象</title> <script type="text/javascript" src="jquery-1.10.1.js"></script> <script type="text/javascript" src="demo.js"></script> <link type="text/css" rel="stylesheet" href="style.css" /> </head> <body> <input type="button" value="按钮" /> <input type="text" value="按钮" /> <div style="width:200px; height:200px; background:#ccc;"> <span style="width:100px; height:100px; background:#eee; display:block;"></span> </div> <p style="height:2000px;"></p> </body> </html>
demo.js
$(function(){ /* $('input').bind('click',function(e){ alert(e); }); $('input').bind('click',function(e){ //alert(e.type); //alert(typeof e.type); }); $('input').bind('click',function(e){ alert(e.target); }); $('input').bind('click',function(e){ alert(e.relatedTarget); }); $('input').bind('click',function(e){ alert(e.currentTarget); }); $('div').bind('click',function(e){ alert(e.target); }); $('div').bind('click',function(e){ alert(e.currentTarget); }); //target 是获取触发元素的 DOM,触发元素,就是你点了哪个就是哪个 //currentTarget 得到的是监听元素的 DOM,你绑定的哪个就是那个 $('span').bind('mouseover',function(e){ alert(e.relatedTarget); }); $('div').bind('click',function(e){ alert(this == e.currentTarget); }); $('div').bind('click',function(e){ alert(this == e.target); }); $('div').bind('click',123,function(e){ alert(e.data); }); $('div').bind('click','abc',function(e){ alert(e.data); }); $('div').bind('click',[1,2,3,'a','b'],function(e){ alert(e.data[3]); }); $('div').bind('click',{user:'Lee',age:100},function(e){ alert(e.data.age); }); $(document).bind('click',function(e){ alert(e.pageX+','+e.screenX+','+e.clientX); }); $(document).bind('click',function(e){ alert(e.pageY+','+e.screenY+','+e.clientY); }); $('input').bind('click',function(e){ return 123; }); $('input').bind('click',function(e){ alert(e.result); }); $('input').bind('click',function(e){ return 123; }); $('input').bind('click',function(e){ alert(e.result); }); $('input').bind('click',function(e){ alert(e.timeStamp); }); $('input').bind('mousedown',function(e){ alert(e.which); }); $('input').bind('keyup',function(e){ alert(e.which); }); */ $('input').bind('click',function(e){ alert(e.ctrlKey); }); });
相关推荐
第09章 面向对象的系统开发
9 越疆-Dobot-Python编程与机器人 第九章 面向对象(共1课时).pdf9 越疆-Dobot-Python编程与机器人 第九章 面向对象(共1课时).pdf9 越疆-Dobot-Python编程与机器人 第九章 面向对象(共1课时).pdf9 越疆-Dobot-Python...
第09章 Script API 第10章 运动计算 第11章 运行的方向 第12章 屏幕坐标 第13章 鼠标事件处理 第14章 脚本的运行 第15章 预制体 第16章 (练习) 子弹发射 第17章 物理系统 第18章 碰撞检测 第19章 (练习)...
NULL 博文链接:https://onestopweb.iteye.com/blog/2224508
该资源以思维导图的形式总结软件工程第一章至第九章的知识点,该总结不仅包含课本知识也包含了...第九章 面向对象编程 这些知识点主要是根据自己的理解整理的,若有不清楚的地方可以私信,若有错误的地方,请批评指正。
第09章 Script API 第10章 运动计算 第11章 运行的方向 第12章 屏幕坐标 第13章 鼠标事件处理 第14章 脚本的运行 第15章 预制体 第16章 (练习) 子弹发射 第17章 物理系统 第18章 碰撞检测 第19章 (练习)...
第09章 Script API 第10章 运动计算 第11章 运行的方向 第12章 屏幕坐标 第13章 鼠标事件处理 第14章 脚本的运行 第15章 预制体 第16章 (练习) 子弹发射 第17章 物理系统 第18章 碰撞检测 第19章 (练习)...
c++ 第九章 类和对象.ppt c++
信息系统分析详细总结(第九章 面向对象设计).docx信息系统分析详细总结(第九章 面向对象设计).docx
信息系统分析详细总结(第九章 面向对象设计).pdf信息系统分析详细总结(第九章 面向对象设计).pdf
第04章 面向对象(上) 09 对象的一对一关系
第09章 Script API 第10章 运动计算 第11章 运行的方向 第12章 屏幕坐标 第13章 鼠标事件处理 第14章 脚本的运行 第15章 预制体 第16章 (练习) 子弹发射 第17章 物理系统 第18章 碰撞检测 第19章 (练习)...
软件工程课件第09章面向对象方法学引论.ppt
C++程序设计教程第四版第九章购书项目源代码,此代码是本人在学习的过程中自主仿照编写,为方便学习特此上传,若有侵权之处请及时联系删除.
第09章 高级部分:面向对象
软件工程基础与实例分析第九章面向对象的分析设计与实现.pptx
第09章 Script API 第10章 运动计算 第11章 运行的方向 第12章 屏幕坐标 第13章 鼠标事件处理 第14章 脚本的运行 第15章 预制体 第16章 (练习) 子弹发射 第17章 物理系统 第18章 碰撞检测 第19章 (练习)...
内容:第01章 课程内容 第02章 开发环境 第03章 了解编辑器 第04章 场景与游戏对象 第05章 游戏对象 第06章 图片的使用 第07章 游戏对象与组件 第08章 游戏脚本 第09章 Script API 第10章 运动计算 第11章 运行的...
面向对象程度设计基础课件 09 第九章 类属机制.ppt 面向对象程度设计基础课件 10 第十章 C++的输入输出.ppt 面向对象程度设计基础课件 11 第十一章 面向对象软件构造.ppt 面向对象程度设计基础课件 12 第十二章 结束...