I have this javascript.
$(function () {
$("#generate").click(function () {
$("#number1").val(generateNumb);
#$("#number2");
#$("#number3");
#$("#number4");
});
});
function generateNumb() {
return "000000" + random(10, 16777215).toString(16).toUpperCase();
}
function random(min, max) {
min = Math.ceil(min);
max = Math.floor(max);
return Math.floor(Math.random() * (max - min + 1)) + min;
}
And this html:
<body>
<h1>Number Generator</h1 >
<div>
<input id="generate" type=button value="Generate" /><br/><br/>
MAC Address<br/>
<input id="number1" placeholder="Number 1" /><br/>
<input id="number2" placeholder="Number 2" /><br/>
<input id="number3" placeholder="Number 3" /><br/>
<input id="number4" placeholder="Number 4" /><br/>
</div>
</body>
I would like to add to the script '#number2', '#number3' and #number4 where their respective values are an increment from the previous generated value , meaning where:
- number2 = number1 + 02 (02 being a hex value)
- number3 = number2 + 02 (02 being a hex value)
- number4 = number3 + 02 (02 being a hex value)
How can this be done?
Thank you in advance.
Aucun commentaire:
Enregistrer un commentaire