Ok, I'm writing a code and I've uploaded it on my server, The styling mode is pretty much like the other pages. All the other pages work except for this one.
Here is the code:
<html>
<head>
<style>
.s {
position: fixed;
color: white;
font-family: arial;
top: 14%;
left: 20%;
}
.b {
position: relative;
background-color: orange;
border-color: #B43298;
box-shadow: 10 10 10 10;
}
.txt {
position: relative;
display: block;
}
</style>
</head>
<body style="margin:0 0 0 0;">
<img src="BG.png " width="100%" height="100%" style="z-index:-100;">
<span class="s" style="" id="SS">THE LEGENDARY RPS</span>
<div style="position:fixed; left:38%; top:30%;">
<span class="g">username:</span><input type="text" id="Uname" class="txt" pattern=".{5,}" required title="5 characters minimum" />
<span class="g">password:</span><input type="password" id="pass" class="txt" pattern=".{6,}" required title="6 characters minimum" />
<button class="b" id="BB1" onclick="up()">Log In</button>
</div>
<script>
var W = window.innerWidth;
var H = window.innerHeight;
var R = W / H;
if (R > 2.2 || R < 1) { // MOBILE
document.getElementById("SS").style = "font-size:" + 200 + "%;left:13%;";
document.getElementById("BB1").style = "font-size:" + 80 + "%;left:68%;top:68%;";
var x = document.getElementsByTagName("input");
for (var i = 0; i < x.length; i++) {
x[i].style = "font-size:" + 100 + "%;";
}
var y = document.getElementsByClassName("g");
for (var i = 0; i < y.length; i++) {
y[i].style = "font-size:" + 100 + "%;";
}
} else { // PC
document.getElementById("SS").style = "font-size:" + 700 + "%;left:20%;";
document.getElementById("BB1").style = "font-size:" + 400 + "%;left:68%;top:68%;";
var x = document.getElementsByTagName("input");
for (var i = 0; i < x.length; i++) {
x[i].style = "font-size:" + 190 + "%;";
}
var y = document.getElementsByClassName("g");
for (var i = 0; i < y.length; i++) {
y[i].style = "font-size:" + 190 + "%;";
}
}
function up() {
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
if (xhttp.responseText == "OK") { //log in
var data = {
Uname: document.getElementById("Uname").value
};
redirectPost("Lobby.php", data);
} else if (xhttp.responseText == "E") {
alert("Wrong Username or Password");
} else {
alert("There was a problem connecting to the server");
}
}
xhttp.open("POST", "check.php", true);
xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xhttp.send("Uname=" + document.getElementById("Uname").value + "&pass=" + document.getElementById("pass").value);
}
function redirectPost(url, data) {
var form = document.createElement('form');
document.body.appendChild(form);
form.method = 'post';
form.action = url;
for (var name in
data) {
var input = document.createElement('input');
input.type = 'hidden';
input.name = name;
input.value = data[name];
form.appendChild(input);
}
form.submit();
}
</script>
</body>
</html>
The error occurs in this snippet too
Uncaught SyntaxError: Unexpected end of input
Exactly on the last line
I read this code over and over and it seems to have no problem at all. So anybody has any idea about how and why this is happening and is there a way to fix it?
Aucun commentaire:
Enregistrer un commentaire