兼容firefox的给每一个onClick再附加一个事件
时间:2023-08-24 18:29:47
给每一个onClick再附加一个事件
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <title>onClick再附加一个事件_asp之家</title> <style type="text/css"> body{ } </style> </head> <body> test <script> function addEvent_onclick(obj,func) { with(obj) { if(getAttribute("onclick")==null || typeof(onclick)!='function') { onclick=function(){func();}; } else { var oldonclick=onclick; onclick=function() { oldonclick(); func(); }; } } } function adde() { alert("t"); return false; } addEvent_onclick(document.getElementById("jia"),adde); </script> </body> </html>
标签:onclick,附加事件
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
关于获取HTML元素的CSS属性值函数
2008-09-01 13:20:00
Django处理Ajax发送的Get请求代码详解
2023-06-29 08:40:40
![](https://img.aspxhome.com/file/2023/7/78787_0s.png)
pyqt5 QProgressBar清空进度条的实例
2022-11-28 03:04:08
PSD to CSS —— CSS布局实战新概念系列教程
2009-05-30 16:40:00
![](https://img.aspxhome.com/file/UploadPic/20095/30/11-58s.jpg)
go HTTP2 的头部压缩算法hpack实现详解
2024-05-21 10:27:37
![](https://img.aspxhome.com/file/2023/5/123975_0s.png)
Python的SimpleHTTPServer模块用处及使用方法简介
2023-05-11 06:04:51
![](https://img.aspxhome.com/file/2023/7/76767_0s.jpg)
Vue中使用vux配置代码详解
2023-07-02 16:39:45
Python从MySQL数据库中面抽取试题,生成试卷
2024-01-18 01:40:51
![](https://img.aspxhome.com/file/2023/9/120339_0s.png)
Python爬虫新手入门之初学lxml库
2021-11-19 07:16:29
![](https://img.aspxhome.com/file/2023/2/124952_0s.jpg)
Python爬虫包BeautifulSoup简介与安装(一)
2021-07-25 05:06:10
python中json格式数据输出的简单实现方法
2021-03-04 22:19:19
SQL一条语句统计记录总数及各状态数
2024-01-17 21:53:35
像懒人一样去设计
2009-04-23 12:43:00
![](https://img.aspxhome.com/file/UploadPic/20094/23/01-53s.jpg)
利用Python制作动态排名图的实现代码
2022-02-04 07:40:51
![](https://img.aspxhome.com/file/2023/7/128477_0s.gif)
Python Flask 转换器的使用详解
2023-06-30 15:42:09
![](https://img.aspxhome.com/file/2023/8/95228_0s.jpg)
在微信小程序里使用watch和computed的方法
2024-04-10 16:16:40
用Javascript正则表达式验证Email地址
2009-12-09 15:56:00
python 使用 requests 模块发送http请求 的方法
2021-06-02 17:29:19
Python def函数的定义、使用及参数传递实现代码
2023-02-23 04:54:34
mysql数据库无法被其他ip访问的解决方法
2024-01-25 09:04:57