I am trying to print out images on the dice, instead of just the number. But when i am using document.write, it just opens a new tab, and shows the picture. What should i use to print it out, with the button i have?
<div id="roll-dice">
<button type="button" value="Trow dice" onclick="rolldice()">Roll dice</button>
<span id="roll-result"></span>
</div>
var rollResult = Math.floor(Math.random() * 6) + 1;
if (rollResult == 1) document.write('<img src="1.jpg">');
else if (rollResult == 2) document.write('<img src="2.jpg">');
else if (rollResult == 3) document.write('<img src="3.jpg">');
else if (rollResult == 4) document.write('<img src="4.jpg">');
else if (rollResult == 5) document.write('<img src="5.jpg">');
else document.write('<img src="6.jpg">');