web前端|html教程
html,触发,元素
web前端-html教程
盗取网站源码软件,ubuntu的系统换,水陆爬虫推荐,enum php,海南seo费用lzw
实例
activiti 实例项目源码下载,ubuntu 挂载网卡,tomcat创建数据源,爬虫馆 广州,php专业开发工具,安踏淘宝旗舰店seo优化设计lzw
当双击鼠标按钮时执行一段 JavaScript:
美丽说 源码,ubuntu有yum命令,tomcat如何设置自动服务,冷血爬虫电影,安装php的mysql扩展,seo举报lzw
浏览器支持
IE
Firefox
Chrome
Safari
Opera
所有主流浏览器都支持 ondblclick 属性。
定义和用法
ondblclick 属性在鼠标双击元素时触发。
注释:ondblclick 属性不适用以下元素:、、 、、、、、、、
或
HTML 4.01 与 HTML5 之间的差异
无。
语法
属性值
最近项目中遇到了在同一DOM元素上需要添加 onclick 和 ondblclick 2个事件,如果按照正常的方式添加处理,结果发现只会执行 onclick,
而不会执行 ondblclick;这时我们需要对2个事件的处理函数稍作处理就可以实现2个事件并存了,代码如下:
var clickTimer = null; function _click(){ if(clickTimer) { window.clearTimeout(clickTimer); clickTimer = null; }clickTimer = window.setTimeout(function(){ // your click process code here alert("你单击了我"); }, 300); } function _dblclick(){ if(clickTimer) { window.clearTimeout(clickTimer); clickTimer = null; }// your click process code here alert("你双击了我"); }