-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathindex.html
69 lines (60 loc) · 2.05 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
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
<html>
<head>
<link rel="stylesheet" type="text/css" href="stylesmenu.css">
<script type="text/javascript" src="lib/keyboard.js"></script>
<script>
function openMenu(element) {
var menu = document.getElementById(element);
var menuHeight = screen.height / 2;
var menuWidth = screen.width / 4.2;
menu.style.height = menuHeight + "px";
menu.style.width = menuWidth + "px";
menu.style.marginTop = "-" + (menuHeight/2).toString() + "px";
menu.style.marginLeft = "-" + (menuWidth/2).toString() + "px";
menu.style.visibility = "visible";
}
function closePopupMenu(element) {
var menu = document.getElementById(element);
menu.style.visibility = "hidden";
}
function startGame() {
var e = document.getElementById("dropDownMapMenu");
var map = e.options[e.selectedIndex].value;
sessionStorage.setItem("map", map);
console.log(sessionStorage.getItem("map"));
window.location = "game.html";
}
function joinGame() {
var server = document.getElementById("server").value;
sessionStorage.setItem("server", server);
window.location = "game.html";
}
</script>
</head>
<body>
<table id="menu">
<tr>
<td><a href="#" onClick="openMenu('newGameMenu')">New Game</a></td>
</tr>
<tr>
<td><a href="#" onClick="openMenu('joinGameMenu')">Join Server</a></td>
</tr>
</table>
<div class="PopupMenu" id="newGameMenu" style="visibility:hidden;">
Map
<select id="dropDownMapMenu">
<option value="">< Random Map ></option>
<option value="cs_assault.bsp">cs_assault</option>
<option value="cs_italy.bsp">cs_italy</option>
</select>
<hr />
<button id="menuStartButton" onclick="startGame()">Start</button>
<button id="menuCancelButton" onclick="closePopupMenu('newGameMenu')">Cancel</button>
</div>
<div class="PopupMenu" id="joinGameMenu" style="visibility:hidden;">
<input id="server"/>
<button id="menuStartButton" onclick="joinGame()">Join</button>
<button id="menuCancelButton" onclick="closePopupMenu('joinGameMenu')">Cancel</button>
</div>
</body>
</html>