如何某浏览器不支持indexof,你可以在编写scripts时,在其开头使用以下代码,它能够允许你在没有本地支持的情况下使用indexof方法。
if (!array.prototype.indexof) { array.prototype.indexof = function(searchelement, fromindex) { var k; if (this == null) { throw new typeerror('this is null or not defined'); } var o = object(this); var len = o.length >>> 0; if (len === 0) { return -1; } var n = +fromindex || 0; if (math.abs(n) === infinity) { n = 0; } if (n >= len) { return -1; } k = math.max(n >= 0 ? n : len - math.abs(n), 0); while (k