I am making a javascript code that has a button and when I click on it, it displays one of 5 symbols but when I click the button, it shows the random symbol but the button disapears. I'm new to javascript so can I please get some help?
<script>
function slots()
{
var slot1 = Math.floor(Math.random()*5);
if (slot1 == 0)
{
document.write("\u2663");
}
if (slot1 == 1)
{
document.write("\u2665");
}
if (slot1 == 2)
{
document.write("\u2666");
}
if (slot1 == 3)
{
document.write("\u2660");
}
if (slot1 == 4)
{
document.write("7");
}
}
</script>
<button type="button" value="Spin" name="SPIN"onClick="slots(); return false;"></button>
</body>
</html>
Aucun commentaire:
Enregistrer un commentaire