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的支持问题
时间: 2024-10-06 15:47:35