i have 5 input text,
after insert a value and click submit i want calculate that number are repeat
example
input text1: 14
input text2: 14
input text3: 30
input text4: 5
input text5: 5
submit
value repeat
14 2
30 1
5 2
<script language="javascript">
<!--
function calcola(){
var myArray = new Array(4);
myArray[0] = document.form1.campo1.value;
myArray[1] = document.form1.campo2.value;
myArray[2] = document.form1.campo3.value;
myArray[3] = document.form1.campo4.value;
myArray[4] = document.form1.campo5.value;
var sum1 = 0;
var valore1 = document.form1.campo1.value;
for (var i=0; i<myArray.length; i++)
{
if(valore1 == myArray)
{
sum1 = sum1 + 1;
}
}
document.form1.campo1_val.value = valore1;
document.form1.campo1_rip.value = sum1;
}
//-->
</script>
after insert a value and click submit i want calculate that number are repeat
example
input text1: 14
input text2: 14
input text3: 30
input text4: 5
input text5: 5
submit
value repeat
14 2
30 1
5 2
<script language="javascript">
<!--
function calcola(){
var myArray = new Array(4);
myArray[0] = document.form1.campo1.value;
myArray[1] = document.form1.campo2.value;
myArray[2] = document.form1.campo3.value;
myArray[3] = document.form1.campo4.value;
myArray[4] = document.form1.campo5.value;
var sum1 = 0;
var valore1 = document.form1.campo1.value;
for (var i=0; i<myArray.length; i++)
{
if(valore1 == myArray)
{
sum1 = sum1 + 1;
}
}
document.form1.campo1_val.value = valore1;
document.form1.campo1_rip.value = sum1;
}
//-->
</script>