-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
32 lines (29 loc) · 1.02 KB
/
index.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
<html>
<head>
<title>Snake Game</title>
<style>
canvas{
display: block;
margin: 0 auto;
}
</style>
</head>
<div id="Start button">
<button onclick="functionToExec()">Start Game</button>
</div>
<div id="Quit">
<button onclick="location.reload();;"> Quit </button>
</div>
<script>document.getElementById("Quit").innerHTML="";</script>
<canvas id="snake" width="608" height="608"></canvas>
<script type="text/javascript">
function functionToExec() {
var script = document.createElement("script");
script.type = "text/javascript";
script.src = "snake.js";
document.getElementsByTagName("head")[0].appendChild(script);
document.getElementById("Start button").innerHTML="";
document.getElementById("Quit").innerHTML= '<button onclick="location.reload();;"> Quit </button>';
}
</script>
</html>