diff --git a/dicee.html b/dicee.html new file mode 100644 index 0000000..e7762cf --- /dev/null +++ b/dicee.html @@ -0,0 +1,30 @@ + + + + + Dicee + + + + +
+

Refresh Me

+ +
+

Player 1

+ +
+ +
+

Player 2

+ +
+
+ + + + + diff --git a/images/dice1.png b/images/dice1.png new file mode 100644 index 0000000..543a9ee Binary files /dev/null and b/images/dice1.png differ diff --git a/images/dice2.png b/images/dice2.png new file mode 100644 index 0000000..472bbac Binary files /dev/null and b/images/dice2.png differ diff --git a/images/dice3.png b/images/dice3.png new file mode 100644 index 0000000..5bb30aa Binary files /dev/null and b/images/dice3.png differ diff --git a/images/dice4.png b/images/dice4.png new file mode 100644 index 0000000..2c116a9 Binary files /dev/null and b/images/dice4.png differ diff --git a/images/dice5.png b/images/dice5.png new file mode 100644 index 0000000..d566cd8 Binary files /dev/null and b/images/dice5.png differ diff --git a/images/dice6.png b/images/dice6.png new file mode 100644 index 0000000..8b98b3c Binary files /dev/null and b/images/dice6.png differ diff --git a/index.js b/index.js new file mode 100644 index 0000000..fd1343f --- /dev/null +++ b/index.js @@ -0,0 +1,34 @@ + +//set both dices to 6 +document.querySelector(".img1").setAttribute("src","./images/dice6.png"); +document.querySelector(".img2").setAttribute("src","./images/dice6.png"); + +//set random numbers +var randomNumber1 = Math.floor(Math.random() * 6) + 1; +var randomNumber2 = Math.floor(Math.random() * 6) + 1; + +//set dice name +var dice1= "dice"+randomNumber1+".png"; +var dice2= "dice"+randomNumber2+".png"; + +//place this image inside the element +document.querySelector(".img1").setAttribute("src","./images/"+dice1); +document.querySelectorAll("img")[1].setAttribute("src","./images/"+dice2); + + + +//set conditions +if(randomNumber1>randomNumber2) + { +document.querySelector("h1").innerHTML="Player 1 Wins!"; + }; + +if(randomNumber1