Repository navigation
Expand file tree
/
Copy pathgame.html
More file actions
85 lines (82 loc) · 2.73 KB
/
Copy pathgame.html
File metadata and controls
85 lines (82 loc) · 2.73 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<title>Catch me if you can</title>
<link type="image/x-icon" rel="icon" href="pngtree-smile-face-emoji-png-image_10203761.png">
<script>
i = 0;
function huntme() {
function start() {
var height = document.documentElement.clientHeight;
var width = document.documentElement.clientWidth;
var x = Math.floor(Math.random() * height);
var y = Math.floor(Math.random() * width);
var a = document.getElementById("smile");
a.style.left = (y - 150) + 'px';
a.style.top = (x - 150) + 'px';
a.style.display = "block";
i++;
document.getElementById("score").innerHTML = i;
}
rv = setTimeout(start,10)
function clt(){
clearTimeout(rv)
r=Math.floor(Math.random()*10000)+5000
alert(r)
}
setTimeout(clt,r)
}
h = 0;
function darkmode() {
if (h == 0) {
document.body.style.backgroundColor = "black"
document.body.style.color = "white";
document.getElementById("mode").innerHTML = "Switch to Bright mode"
h++
}
else {
document.body.style.backgroundColor = "white"
document.body.style.color = "black";
document.getElementById("mode").innerHTML = "Switch to dark mode"
h = 0;
}
}
function weclome() {
nam = document.getElementById("na").value
document.getElementById("name").innerHTML = nam
}
// I want to set a schedule to turn of the function
</script>
<style>
body {
padding: 25px;
background-color: white;
color: black;
font-size: 25px;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
div {
display: inline;
}
#smile {
position: absolute;
left: 00px;
top: 00px;
display: none;
}
button{padding: 15px; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; border-radius: 20px;
background-color: rgb(0, 0, 59); color: white; font-weight: 500;}
button:hover{ background-color: white; color: rgb(0, 0, 59) ;}
</style>
<body>
<center>
<H1>Catch me if you can</H1>
<button onclick="huntme()">START</button>
<br><br>
<div id="smile">
<img src="pngtree-smile-face-emoji-png-image_10203761.png" alt="huntme" height="30%" onmouseover="huntme()">
</div>
<div id="your">score : <div id="score"></div>
</div>
<br><br>
<button onclick="darkmode()" id="mode">Switch to darkMode</button>
<p><center>© Mudit Game Development</center></p>
</center>
</body>