此代码是根据CSDN梅花雪的去掉数组中重复的元素扩展的
<form name=form1>
<input name=a123>
<input name=b123>
<input name=c123>
<input name=d123>
<input name=e123>
<input name=f123 type=button οnclick=check()>
</form>
<SCRIPT LANGUAGE="JavaScript">
<!--
Array.prototype.unique = function()
{
var a = {}; for(var i=0; i<this.length; i++)
{
if(typeof a[this[i]] == "undefined")
a[this[i]] = 1;
}
this.length = 0;
for(var i in a)
this[this.length] = i;
return this;
}
function check()
{
var ArrText = [document.form1.a123.value,document.form1.b123.value,document.form1.c123.value,document.form1.d123.value,document.form1.e123.value];
OldArr=ArrText.length;
NewArr=ArrText.unique().length;
if(OldArr==NewArr)
{
alert("无重复记录");
}
else
{
alert("有重复记录");
}
}
//-->
</SCRIPT>