今天在修改公司项目的bug时发现一个问题,出错代码如下:

1 clearTimeout();
2 setTimeout(function(){
3    // 具体业务逻辑
4 },100);

这段代码在chrome、firefox浏览器中不会报错,但在IE上会报“参数是必选的”这个错误信息,也就是clearTimeout这个方法必须要传一个参数,具体应修改为:

1 var timer = null;
2 
3 
4 clearTimeout(timer);
5 timer = setTimeout(function(){
6    _this.imgUrl='/api/login/defaultKaptcha';
7 },100);

 

转载于:https://www.cnblogs.com/NickyLi/p/10483028.html

今天在修改公司项目的bug时发现一个问题,出错代码如下:

1 clearTimeout();
2 setTimeout(function(){
3    // 具体业务逻辑
4 },100);

这段代码在chrome、firefox浏览器中不会报错,但在IE上会报“参数是必选的”这个错误信息,也就是clearTimeout这个方法必须要传一个参数,具体应修改为:

1 var timer = null;
2 
3 
4 clearTimeout(timer);
5 timer = setTimeout(function(){
6    _this.imgUrl='/api/login/defaultKaptcha';
7 },100);

 

相关文章:

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