dimanche 28 février 2016

generate random number not working

Hi great ppl of stackoverflow.

i am trying to generate random numbers using jquery. However, it didnt generate when i refresh the broswer.

my html as follows:

<td colspan="3" id="number1" class="numberStyle"><span>1</span></td>
<td colspan="3" id="number2" class="numberStyle"><span>2</span></td>

my script as follows:

 $(document).ready(function(){
var num1;
var num2;

num1=Math.floor((Math.random()*3)+1);
document.getElementById("number1").innerhtml = num1;

num2=Math.floor((Math.random()*3)+1);
document.getElementById("number2").innerhtml = num2;

});

Kindly advise. thanks a lot




Aucun commentaire:

Enregistrer un commentaire