Funziona benissimo. Ho preso i 4 primi campi
codice:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Untitled</title> <script language="JavaScript" type="text/javascript"> <!-- function guestForm(){ var tot_isr = document.getElementById("tot_isr"); var tot_vig = document.getElementById("tot_vig"); var tot_bra = document.getElementById("tot_bra"); var tot_gre = document.getElementById("tot_gre"); tot_isr = parseInt(tot_isr.value, 10); tot_vig = parseInt(tot_vig.value, 10); tot_bra = parseInt(tot_bra.value, 10); tot_gre = parseInt(tot_gre.value, 10); var arrVal = new Array(); arrVal[arrVal.length] = tot_isr ; arrVal[arrVal.length] = tot_vig ; arrVal[arrVal.length] = tot_bra ; arrVal[arrVal.length] = tot_gre ; ok = true; for (i=0;i<arrVal.length;i++) { for (j=0;j<arrVal.length;j++) { if (arrVal[i] != arrVal[j]) { ok = false; } // if (arrVal[i] != arrVal[j]) } // for (j=0;j<arrVal.length;j++) } // for (i=0;i<arrVal.length;i++) alert(ok); } //--> </script> </head> <body> <input type="text" id="tot_isr"> <input type="text" id="tot_vig"> <input type="text" id="tot_bra"> <input type="text" id="tot_gre"> <input type="button" onclick="guestForm()"> </body> </html>

Rispondi quotando