紧急求助,lastIndexOf为什么在IE8下不识别
视频效果的JS在IE9里一直报错:无法获取未定义或null引用的属性“lastIndexOf”请问怎么解决...
视频效果的JS在IE9里一直报错:无法获取未定义或 null 引用的属性“lastIndexOf”
请问怎么解决 展开
请问怎么解决 展开
展开全部
if (!Array.prototype.indexOf){
Array.prototype.indexOf = function(elt /*, from*/){
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;
};
}
http://blog.csdn.net/xb12369/article/details/20922301你可以看看
Array.prototype.indexOf = function(elt /*, from*/){
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;
};
}
http://blog.csdn.net/xb12369/article/details/20922301你可以看看
更多追问追答
追问
我在js中加了这段代码,还是不好用,醉了 /哭/哭/哭
追答
呃呃呃
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询