Basta cambiare due righette...
codice:
<script type="text/javascript"><!--
// MATRICE -----------------------------------------------------------------------------
// numero di utenti
var N = 4;
// creazione
var utenti = new Array();
creaMatrice(utenti, N);
// assegnazione valori: posizione 0 -> nome utente, posizione 1 -> password
utenti[0][0] = "piero"; utenti[0][1] = "Piero";
utenti[1][0] = "ingCane"; utenti[1][1] = "mille";
utenti[2][0] = "cwm"; utenti[2][1] = "cwm";
utenti[3][0] = "LL"; utenti[3][1] = "cheSogno!";
// FINE MATRICE -------------------------------------------------------------------------
function creaMatrice(nome, elementi) {
for (var i = 0; i < elementi; i++) {
nome[i] = new Array;
}
}
function controlla() {
var nome = document.getElementById("i1");
var pass = document.getElementById("i2");
var trovato = false;
if (nome.value != "" && pass.value != "") {
for (var i = 0; i < utenti.length; i++) {
if (nome.value == utenti[i][0] && pass.value == utenti[i][1]) {
window.location = "www.itgmarinoni.it";
}
}
if (trovato == false) window.alert("Utente non trovato!");
} else {
window.alert("Errore: compilare tutti i campi!");
}
}
function stampaUtenti() {
for (var i = 0; i < utenti.length; i++) {
document.getElementById("listaUtenti").innerHTML += "[*]" + utenti[i][0] + " -> " + utenti[i][1] + ""
}
}
//--></script>