in news:28*************************@posting.google.co m,
Boefje typed:
Hi,
What I want it simpel. I have got 8 input fields on a form named
title[1] to title[8].
I want to check in a function if there are no double titles. I have
got a solution, but it is plain ugly.
How to achieve this in a elegant way?
Thans for your time.
G.B.
this is the result of being so tired that you are even too tired to turn the
pc off and go to bed.......
<html>
<script>
function eatyourpeas(){
var telephonenumber = new Array();
var howaboutbeans = new String();
for (i=1;i<9;i++){
eval ("howaboutbeans = document.forms[0].thingy" + i + ".value");
if (telephonenumber[howaboutbeans] == howaboutbeans) {
alert ("Found duplicate " + howaboutbeans);
}
telephonenumber[howaboutbeans] = howaboutbeans;
}
}
</script>
<body>
<form name="freakenfrackitty">
<input name="thingy1" type="text" value="a"><br>
<input name="thingy2" type="text" value="b"><br>
<input name="thingy3" type="text" value="c"><br>
<input name="thingy4" type="text" value="d"><br>
<input name="thingy5" type="text" value="e"><br>
<input name="thingy6" type="text" value="a"><br>
<input name="thingy7" type="text" value="g"><br>
<input name="thingy8" type="text" value="h"><br>
<input name="fffff" type="button" onclick="eatyourpeas();"><br>
</form>
</body>
</html>