-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
44 lines (44 loc) · 1.42 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Play Runic</title>
<link rel="stylesheet" href="css/title.css">
</head>
<body>
<div class="center">
<h1 class="name">
RUNIC
</h1>
<input id="runic_username" class="username" placeholder="Username" maxlength="16"><br>
<input id="runic_server_url" class="username" placeholder="example.com:8080"><br>
<input type="button" class="play" onclick="play()" value="PLAY">
</div>
<script>
var usernameinput = document.getElementById("runic_username");
var urlinput = document.getElementById("runic_server_url");
function play() {
/*if (username != "") {
window.location = "game.html" + "?name=" + username;
}
else {
window.location = "game.html";
}*/
let parameters = new String();
if (usernameinput.value != "") {
parameters += "?name=" + usernameinput.value;
}
if (urlinput.value != "") {
parameters += "&?server_url=" + urlinput.value;
}
window.location = "game.html" + parameters;
}
usernameinput.addEventListener("keypress", function(event) {
if (event.key === "Enter") {
event.preventDefault();
play();
}
});
</script>
</body>
</html>