<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>Dicee</title>
<link rel="stylesheet" href="styles.css">
<link href="https://fonts.googleapis.com/css?family=Indie+Flower|Lobster" rel="stylesheet">
</head>
<body>
<script src="index.js"></script>
<div class="container">
<h1>Refresh Me</h1>
<div class="dice">
<p>Player 1</p>
<img class="img1" src="images/dice6.png">
</div>
<div class="dice">
<p>Player 2</p>
<img class="img2" src="images/dice6.png">
</div>
</div>
</body>
<footer>
Tudor R. Ardelean © 2022
</footer>
</html>
function randomImage()
{
document.querySelector(".img1").setAttribute("src", "images/dice" + (Math.floor(Math.random() * 6) + 1) + ".png");
}
How do I use the script that I wrote (just that function) to replace the image with another one? I have the other 5 dice pics saved in my computer. So every time when I refresh the page, I should get another one, another one, another one, and so on. Thanks in advance!