Skip to content

Instantly share code, notes, and snippets.

@Tebreca
Created August 16, 2017 15:47
Show Gist options
  • Save Tebreca/3e3d10ba10c3993acbcb49057ee078b5 to your computer and use it in GitHub Desktop.
Save Tebreca/3e3d10ba10c3993acbcb49057ee078b5 to your computer and use it in GitHub Desktop.
quick HTML and JS login page
<!DOCTYPE html>
<html>
<head>
<title>eaglOS login</title>
<link rel="stylesheet" href="styles/login.css">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<div class="container">
<form name="login">
<div class="Iinput">Username</div>
<input class="Iinput" type="text" id="username">
<div class="Iinput">Password</div>
<input class="Iinput" type="password" id="password"><br>
<button type="button" onclick="testtrue();" name="loginbutton">login</button>
</form>
</div>
<script>
function testtrue(){
var Usname = document.getElementById("username").value;
var passW = document.getElementById("password").value;
var lengthun = document.getElementById("username").length;
var lengthpw = document.getElementById("password").length;
if (Usname === "Test" && passW === "test"){
window.location.replace("./users/ewan/desktop.html");
}else {
console.log("password: " + passW + " isn't valid!!");
}
}
</script>
</body>
</html>
@Tebreca
Copy link
Author

Tebreca commented Aug 16, 2017

Css:

body {
    background-image: url("http://www.planwallpaper.com/static/images/beautiful-white-flowers-in-fields-with-blue-sky-background-hd-wallpapers-1_2vIoYwq.jpg");
    background-size: 100%;
}

.container {
   margin-left: 590px;
   margin-top: 200px;
   background-color: gray;
   padding: 0px;
   border-color: black;
   border-style: solid;
   width: 200px;
   border-radius: 13px;
}

button {
    margin-bottom: 2.5px;
    margin-left: 30px;
    width: 145px;
}

.Iinput{
    margin-left: 16px;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment