lundi 12 mars 2018

display a variable - Random

Good evening,

I have a bug after several tries I still can not find the solution :(

  I would like to see a month click when you click again another month is displayed but not the same you remove it from the list

That's my code for the moment

Being very novice but looking on google I did not find an answer to my question

<button onclick="randommonth()">Try it</button>


<p id="mois"></p>

<script>
function randomonth() {
var tbl="janvier,février,mars,avril,mai,juin,juillet,août,septembre,novembre,décembre".split',');
var randMois=[];

while (tbl.length) randMois.push(tbl.splice(Math.random()*tbl.length,1)[0]);
  document.getElementById("mois").innerHTML = tbl;

 }
</script>

Thank's for your help :)




Aucun commentaire:

Enregistrer un commentaire