1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 2 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
 3 <head>
 4     <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
 5     <title>IE事件处理</title>
 6     <input type="button" value="按钮1" ID="btn1">
 7 </head>
 8 <body>
 9     <!-- 支持IE事件处理程序的浏览器有 IE8及以下opera
10      -->
11     <script type="text/javascript">
12         var btn1=document.getElementById('btn1');
13         //↓添加事件
14         btn1.attachEvent('onclick', fun);
15         //↓注释的这一行为删除事件处理。
16         //btn1.detachEvent('onclikc', fun());
17         function fun(){
18             alert('IE事件处理');
19         }
20         
21     </script>
22 </body>
23 </html>

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-26
  • 2021-11-08
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-10-15
  • 2022-12-23
  • 2021-08-07
  • 2021-06-18
  • 2021-09-04
相关资源
相似解决方案