0
I would like to do the inverse of this script, in this script you click the GENERATE button, it generates 4 digits
What I want to do is the reverse, I want to declare the variable "1298105" (or any other) and click on Generate and it generate below in one <div>
the result "1298105XXXX" as declared in input
How to do, some example ?
function gerar() {
// numero aleatorios
var numeros = [];
for (var i = 0; i < 4; ++i) {
var sorteio = Math.floor(Math.random() * 9);
if (sorteio == 0)
sorteio = 1; // 1 - 9
numeros[i] = sorteio;
}
var senha = numeros.join('');
document.getElementById('txtsenha').value = senha;
}
<input type="text" name="txtsenha" id="txtsenha"/>
<input type="button" value="Gerar" onclick="javascript:gerar()"/>
That’s right Leo, Thanks for the reply , take a look at my profile, I’m having another problem with javas ( already searched solution on google and not found ), if you can show me the way I’m grateful.
– Mandrake Venom