<div class="htmlarea"> <textarea id="runcode44723"> <script language="JavaScript"> <!-- function Each(list, fun){ for (var i = 0, len = list.length; i < len; i++) { fun(list[i], i); } }; var arr = [1,2,3,4,1,3] var t Each(arr.sort(), function(o,i){ if(i>0 && o == t){ alert("相同的:" + o); } alert(t) t = o; }) //--> </script> </textarea><br><input onclick="runEx('runcode44723')" type="button" value="运行代码"> <input onclick="doCopy('runcode44723')" type="button" value="复制代码"> <input onclick="doSave(runcode44723)" type="button" value="保存代码">[Ctrl+A 全选 注:<a href="http://www.jb51.net/article/23421.htm" title="查看具体详情" target="_blank">如需引入外部Js需刷新才能执行</a>]</div>