Array.indexOf 函数。使用 indexOf 函数查找Array 中某个值第一个匹配项的索引。下面示例展示如何使用indexOf 函数来得到一个item的索引值. 返回第一次出现的 item的索引. 你可以发现再次调用函数查找含有 item 有数组时可以采用 开始索引值的不同来查找下一个匹配项的索引. JavaScript.var a = [‘red‘, ‘blue‘, ‘green‘, ‘blue‘];var myFirstIndex = Array.indexOf(a, "blue");// 返回结果: "1"document.write("myFirstIndex: ",myFirstIndex,"
文章来源: http://blog.csdn.net/chsword/archive/2007/02/25/1514186.aspx

文章来源: http://blog.csdn.net/chsword/archive/2007/02/25/1514186.aspx