1 <script type="text/javascript">
2 <!--
3 var dispatchEvent=function(obj,event,fun){
4 if(obj.attachEvent)
5 obj.attachEvent(event.indexOf('on')>-1?event:'on'+event,fun);
6 else
7 addEventListener(event.indexOf('on')>-1?event.substring(2):event,fun,false);
8 };
9 window.onload=function()
10 {
11 alert('1');
12 }
13 function testAlert()
14 {
15 alert('2');
16 }
17 dispatchEvent(window,'onload',testAlert);
18 // -->
19   </script>

 

相关文章:

  • 2021-10-04
  • 2022-12-23
  • 2021-10-13
  • 2021-09-12
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-07-04
  • 2022-01-13
  • 2022-12-23
  • 2021-10-24
  • 2022-01-21
相关资源
相似解决方案