-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
51 lines (47 loc) · 1.69 KB
/
index.js
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
43
44
45
46
47
48
49
50
51
var randomNumber1=Math.floor(Math.random()*6)+1;
if (randomNumber1 == 1){
document.querySelector("img.img1").setAttribute("src", "images/dice1.png");
}
else if (randomNumber1 == 2){
document.querySelector("img.img1").setAttribute("src", "images/dice2.png");
}
else if (randomNumber1 == 3){
document.querySelector("img.img1").setAttribute("src", "images/dice3.png");
}
else if (randomNumber1 == 4){
document.querySelector("img.img1").setAttribute("src", "images/dice4.png");
}
else if (randomNumber1 == 5){
document.querySelector("img.img1").setAttribute("src", "images/dice5.png");
}
else if (randomNumber1 == 6){
document.querySelector("img.img1").setAttribute("src", "images/dice6.png");
}
var randomNumber2=Math.floor(Math.random()*6)+1;
if (randomNumber2 == 1){
document.querySelector("img.img2").setAttribute("src", "images/dice1.png");
}
else if (randomNumber2 == 2){
document.querySelector("img.img2").setAttribute("src", "images/dice2.png");
}
else if (randomNumber2 == 3){
document.querySelector("img.img2").setAttribute("src", "images/dice3.png");
}
else if (randomNumber2 == 4){
document.querySelector("img.img2").setAttribute("src", "images/dice4.png");
}
else if (randomNumber2 == 5){
document.querySelector("img.img2").setAttribute("src", "images/dice5.png");
}
else if (randomNumber2 == 6){
document.querySelector("img.img2").setAttribute("src", "images/dice6.png");
}
if(randomNumber1 == randomNumber2){
document.querySelector("h1").innerHTML="Durrang";
}
else if(randomNumber1 < randomNumber2){
document.querySelector("h1").innerHTML="2-o'yinchi g'olib";
}
else {
document.querySelector("h1").innerHTML="1-o'yinchi g'olib";
}