-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathludoo.html
42 lines (39 loc) · 1.48 KB
/
ludoo.html
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
32
33
34
35
36
37
38
39
40
41
42
<!DOCTYPE html>
<html>
<head>
<title></title>
<link rel="stylesheet" type="text/css" href="style.css">
<link href="https://fonts.googleapis.com/css?family=Acme" rel="stylesheet">
<script>
ludogame = () => {
const play1 = Math.floor(Math.random() * 6) + 1;
const play1dice = `images/dice${play1}.png`;
document.getElementById('check1').setAttribute('src', play1dice);
const play2 = Math.floor(Math.random() * 6) + 1;
const play2dice = `images/dice${play2}.png`;
document.getElementById('check2').setAttribute('src', play2dice);
if(play1 > play2)
{ document.querySelector('h1').innerHTML="Player 1 won :)";
} else if(play1 < play2) {
document.querySelector('h1').innerHTML="Player 2 won :)";
} else{ document.querySelector('h1').innerHTML="DRAW "; }
}
</script>
</head>
<body>
<div class="container">
<h1 align="center" style="font-size:120px;color:yellow;text-shadow:4px 4px 5px red; letter-spacing:10px;" id="f5">JS LUDO</h1>
<div class="dice">
<p>Player 1</p>
<img src="images/dice1.png" id="check1">
</div>
<div class="dice">
<p>Player 2</p>
<img src="images/dice6.png" id="check2">
</div>
<div>
<button onclick="ludogame()"> Click ME</button>
</div>
</div>
</body>
</html>