Here is some thing interesting for you all.As you all know that in every project we all need
demo sign in and login in part and this put stars in our projects.Customize
it according to your need so that it seems more beautiful.
See live Demo
Add this html code in a new page into a section in you project
Already have an account. Then
Don't have account. Then
Add this CSS Code in your style sheet.
* {
background-color: rgb(207, 188, 188);
color: rgb(53, 53, 70);
}
#login-div {
display: none;
}
#login-or-signup {
width: 150px;
}
Add this javascript code into the script section or in your external js file.
function signup() {
window.localStorage.clear();
var name = document.getElementById("iname").value;
var email = document.getElementById("iemail").value;
var pass = document.getElementById("ipass").value;
if (((email.localeCompare("")) === 0) || ((name.localeCompare("")) === 0) || ((pass.localeCompare("")) === 0)) {
location.reload();
window.localStorage.clear();
alert("All field are mandatory.")
} else {
localStorage.setItem("mname", name);
localStorage.setItem("memail", email);
localStorage.setItem("mpass", pass);
alert("Your account is created, Please sign in");
}
}
function signin() {
var myemail = localStorage.getItem("memail");
var mypass = localStorage.getItem("mpass");
var eemail = document.getElementById("oemail").value;
var epass = document.getElementById("opass").value;
console.log(myemail);
console.log(mypass);
console.log(eemail);
console.log(epass);
if ((eemail.localeCompare(myemail)) == 0 && (epass.localeCompare(mypass)) == 0) {
alert("Thank you for signing in");
window.localStorage.clear();
} else {
alert("Wrong Password or Email Address,Try again signing in");
}
}
function showin() {
document.getElementById("login-div").style.display = "block";
document.getElementById("signup-div").style.display = "none";
}
function showup() {
document.getElementById("login-div").style.display = "none";
document.getElementById("signup-div").style.display = "block";
}
Feel free to use this in your projects.