Prototype使用Event
来源:互联网 发布:美工多少钱一个月 编辑:程序博客网 时间:2024/04/29 10:44
1.前言
下面是Event的通用event事件:
1) element(event):返回引发event事件的DOM元素。
2) findElement(event,tagName):该方法和element()方法有点类似,只是findElement()并不一定返回事件发生的事件源,它还可能返回该事件源DOM对象所在的容器。
3) isLeftClick(event):判断是否是因为左键单击所引发的事件。
4) observe(element,eventName,handler[,useCapture=false]):将handler注册成element的eventName事件的监听器,useCapture指定handler是否在捕获阶段被触发。
5) pointX(event):返回鼠标事件发生的位置X坐标。
6) pointY(event):返回鼠标 事件发生位置Y坐标。
7) stop(event):停止event事件传播。
8) stopObserving(element,eventName,handler[,useCAPTURE=false]):取消element上绑定的handler监听器。
2.例子
<!DOCTYPE html><html><head><meta name="author" content="OwenWilliam" /><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title> 使用Event </title></head><body><table border="1"><tr><td><div><input id="ok" type="button" value="click me!"/></div></td></tr></table><script src="../../prototype.js" type="text/javascript"></script><script type="text/javascript">Event.observe("ok" , "click" , function(event){alert("是否为左键事件:" + event.isLeftClick());alert("事件源:" + event.element().value);alert("最近的td元素:" + event.findElement("td").innerHTML);});</script></body></html>
3.运行结果
0 0
- Prototype使用Event
- prototype使用学习手册指南之event.js
- 正确使用prototype.js的Event.stopObserving方法
- Prototype学习笔记系列之Event.stopObserving()
- event 使用
- Event使用
- String.prototype使用
- JavaScript的Prototype使用
- prototype获取和使用
- prototype使用的点点滴滴
- javascript prototype 使用
- javascript prototype 使用(转)
- prototype-Ajax.request使用
- JS prototype的使用
- prototype 类的使用
- ProtoType框架的使用
- String.prototype使用
- prototype.js使用详解
- 【iOS】NSDate分类,获得中国农历
- iOS 修炼方法
- 设计模式(4)--使用ASM实现AOP
- uwp开发————拍照
- 使用CocoaPod导入第三方框架
- Prototype使用Event
- nyoj 76 超级台阶
- Jquery过滤性选择器
- Sublime Text 3.0缺失Package Settings和Package Control菜单项
- 上古时代 Objective-C 中哈希表的实现
- Linux下python升级步骤【升级python各种问题,拟合整理】
- Java中的Integer和int等包装类和基本数据类型简单比较
- 如何在服务器重新启动后继续使用session
- (一般)POJ-3040 贪心,硬币问题