-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgame.js
More file actions
31 lines (29 loc) · 911 Bytes
/
Copy pathgame.js
File metadata and controls
31 lines (29 loc) · 911 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
function game()
{
var xo = document.getElementById("celebration");
var x = Math.floor(Math.random() * 5) +1;
var paath = "images/"
var ImgSrc1 = paath + "d" + x + ".png";
var y = Math.floor(Math.random() * 5) +1;
var ImgSrc2 = paath + "d" + y + ".png";
document.getElementById('playa1').setAttribute("src",ImgSrc1);
document.getElementById('playa2').setAttribute("src",ImgSrc2);
if (x > y)
{
var xxx = document.getElementById("celebration");
xxx.style.color = "red";
xxx.innerHTML = "Player 1 Wins";
}
else if (x < y)
{
var xxxx = document.getElementById("celebration");
xxxx.style.color = "red";
xxxx.innerHTML = "Player 2 Wins";
}
else {
var xxxx = document.getElementById("celebration");
xxxx.style.color = "red";
xxxx.innerHTML = "DRAW";
}
document.getElementById("res").innerHTML = "HIT START TO PLAY AGAIN";
}