码迷,mamicode.com
首页 > 其他好文 > 详细

bootstrap datetimepicker兼容ie8

时间:2016-07-04 15:01:19      阅读:140      评论:0      收藏:0      [点我收藏+]

标签:

bootstrap datetimepicker兼容ie8

 (2015-06-09 16:14:00)
  分类: js
错误:由于ie8不支持indexOf这个方法,所以在引入bootstrap-datetimepicker.js的时候在ie8中会js引入错误。
 
解决:
在bootstrap-datetimepicker.js文件前面加入
if (!Array.prototype.indexOf){  
        Array.prototype.indexOf = function(elt ){  
        var len = this.length >>> 0;  
        var from = Number(arguments[1]) || 0;  
        from = (from < 0)  
             ? Math.ceil(from)  
             : Math.floor(from);  
        if (from < 0)  
          from += len;  
        for (; from < len; from++)  
        {  
          if (from in this &&  
              this[from] === elt)  
            return from;  
        }  
        return -1;  
      };  
    }  
可解决ie8对indexOf的支持问题

bootstrap datetimepicker兼容ie8

标签:

原文地址:http://www.cnblogs.com/myclovers/p/5640234.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!