-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
50 lines (38 loc) · 1.14 KB
/
index.html
File metadata and controls
50 lines (38 loc) · 1.14 KB
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
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css">
<link rel="icon" href="https://i.ibb.co/n6WmyPv/icon.png">
<link href="https://fonts.googleapis.com/css2?family=Quicksand:wght@400;500;600;700&display=swap" rel="stylesheet">
<title>Dice</title>
</head>
<body>
<center class="main">
<div class="head">
<p>Dice</p>
</div>
<p class="title">A working javascript dice.</p>
<button onclick="dice()" id="button" class="button3">Click Me</button>
<br>
<br>
<div id="dice-number"></div>
</center>
</body>
</html>
<script type="text/javascript">
var myArray = ["1","2","3","4","5","6"]
function dice(){
var randomItem = myArray[Math.floor(Math.random()*myArray.length)];
document.getElementById("button").style.width = "150px";
document.getElementById('button').innerHTML = "The number is "+randomItem;
document.getElementById('dice-number').innerHTML = "<img src='img/"+randomItem+".png' />";
/*setTimeout(reload, 1000);*/
}
function reload() {
document.getElementById('button').innerHTML = "Reloading ...."
setTimeout(reloade, 100.8);
}
function reloade(){
window.location.reload();
}
</script>