JSFiddle - React, Tailwind, and code Playground
HTML
<!DOCTYPE HTML>
<html>
<head>
<script type=text/javascript>
function rollDice(){
var randomdice= Math.round(Math.random() *5);
document.images["mydice"].src = "d" + randomdice.toString() + ".gif";
}
</script>
</head>
<body>
<img src="d1.gif" name="mydice">
<input type="button" value="Roll" onclick="rollDice()">
</body>
</html>