Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to set random dice image with js

function mathRandomDice() {
    document.getElementById("dice").innerHTML = Math.floor(Math.random() * 6) + 1; 

}

var x = mathRandomDice;

  if (x = 1) {
            d.innerHTML = '<img src=https://image.ibb.co/cQKOhc/dice1.png>';
    }
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #set #random #dice #image #js
ADD COMMENT
Topic
Name
5+3 =