Put A Value Outside A Function In A Global Var
I'm sorry guys, the entire code is this. I given you the short form to be light, but I made many mistakes. So please, ignore the code written before and read this. At the bottom of
Solution 1:
function validatore_numero_giocatori(numero_giocatori) {
alert(numero_giocatori);
window.open("/home/enrico/Scrivania/cod-x/lup-x/gioco/impostazioni: numero lupi vs numero villici.html","_self");
document.getElementById("validazione").innerHTML = scritta_output;
return numero_giocatori;
}
You need to pass the var "numero_giocatori" to the function.
function validatore_numero_giocatori(numero_giocatori)
Then call it like this:
validatore_numero_giocatori(numero_giocatori)
Solution 2:
Substitute your function with this: You need to access the value of the input element.
function validatore_numero_giocatori() {
numero_giocatori = document.getElementById('digitazione_numero_giocatori').value;
alert(numero_giocatori);
window.open("/home/enrico/Scrivania/cod-x/lup-x/gioco/impostazioni: numero lupi vs numero villici.html","_self");
document.getElementById("validazione").innerHTML = scritta_output;
return numero_giocatori;
}
Post a Comment for "Put A Value Outside A Function In A Global Var"