Sunnor

  在项目中遇到了类似于这样的js,

myinit.js文件:

 1 var wyl_01 = {
 2     tip    : function(msg){
 3         alert(\'i am a tip,msg:\'+msg);
 4     },
 5     tip2 :function(){
 6         alert(\'i am the second\');
 7     }
 8 }
 9 //初始化js,只要网页中引入了改js,即引入了myinit.js,那么页面就会立刻执行wyl_01.tip()这个function
10 wyl_01.tip(\'hhhh\');
11 wyl_01.tip2();

在任何引入了myinit.js的网页中不管是jsp或者html等,在页面加载好之前就会执行wyl_01.tip(\'hhhh\')和wyl_01.tip2()这两个方法。

分类:

技术点:

相关文章:

  • 2022-12-23
  • 2021-09-26
  • 2021-11-28
  • 2021-11-28
  • 2022-12-23
  • 2021-12-08
  • 2022-12-23
  • 2021-12-04
猜你喜欢
  • 2021-11-28
  • 2021-11-28
  • 2021-11-28
  • 2021-09-05
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案