Hi,
This sort of works.
<html>
<head>
<title>Array Experiment</title>
</head>
<body>
<form name="form1">
<select name="sel1" id="1st" onchange="checkforduplicates()">
<option value="pig">Pig
<option value="dog">Dog
<option value="monkey">Monkey</option>
</select> <select name="sel2" id="2nd" onchange="checkforduplicates()">
<option value="dog">Dog
<option value="monkey">Monkey
<option value="pig">Pig</option>
</select> <select name="sel3" id="3rd" onchange="checkforduplicates()">
<option value="giraffe">Giraffe
<option value="Pig">Pig
<option value="zebra">Zebra</option>
</select> <select name="sel4" id="4th" onchange="checkforduplicates()">
<option value="wildebeest">Wildebeest
<option value="pigeon">Pigeon
<option value="Pig">Pig</option>
</select> <select name="sel5" id="5th" onchange="checkforduplicates()">
<option value="blackbird">Blackbird
<option value="pig">Pig
<option value="lemur">Lemur</option>
</select>
</form>
<script language ="javascript">
var timer1 = setTimeout("checkforduplicates()", 20)
function checkforduplicates(){
var checksel = {
checksel1 : document.form1.sel1,
checksel2 : document.form1.sel2,
checksel3 : document.form1.sel3,
checksel4 : document.form1.sel4,
checksel5 : document.form1.sel5
}
var holdingpen = new Array(checksel.checksel1.options(checksel.checksel 1.selectedIndex).value, checksel.checksel2.options(checksel.checksel2.sele ctedIndex).value, checksel.checksel3.options(checksel.checksel3.sele ctedIndex).value, checksel.checksel4.options(checksel.checksel4.sele ctedIndex).value, checksel.checksel5.options(checksel.checksel5.sele ctedIndex).value)
holdingpen.sort()
for (var i=0; i<holdingpen.length - 1; i++)
{
if (holdingpen[i] == holdingpen[i+1])
//holdingpen[i+1] = '';
alert(holdingpen[i+1] = holdingpen[i] + ' was duplicated!');
document.form1.reset();
}
}
</script>
</body>
</html>
Hope that helps
interrupt
|