Can you tell me how I can make a user enter their data on a form (email and password) and when they choose to register ("Registar"), the data is stored on variables that can be used right after if the user decides to click "Entrar", so they can Enter without using the default info.
This is a work for school, and I cannot use databases, just Javascript and JQuery.
This is what I got so far (it's a partial copy of the website I am making).
BTW: the id on the button is used for CSS and extra stuff that isn't there is also for styling the page.
<script type="text/javascript">
var newuser;
var newpassword;
function registoTXT() {
newuser = document.getElementById('inputUser').value;
newpassword = document.getElementById('inputPassword').value;
alert("Utilizador Registado!");
}
function check(form) {
if ((form.usermail.value == "sparedes@isec.pt" && form.password.value == "12345678") || (form.username.value == newuser.value && form.password.value == newpassword.value)) {
window.open('VIPZone.html', "_self")
} else {
alert("E-mail ou Password Inválido(s)!")
}
}
</script>
<div class="contents">
<h2>Login</h2>
<blockquote>
<form name="login">
<div class="divTableBody">
<div class="divTable">
<div class="conteudoLogin">
<div class="divTableRow">
<div class="divTableCell">
<label><b>E-mail</b></label>
</div>
<div class="divTableCell">
<input id="inputUser" type="email" name="usermail" placeholder="Endereço@email.com" required>
</div>
</div>
<div class="divTableRow">
<div class="divTableCell">
<label><b>Password</b></label>
</div>
<div class="divTableCell">
<input id="inputPassword" type="password" name="password" placeholder="Password" required>
</div>
</div>
<br>
<div class="divTableRow">
<div class="divTableCell">
<button id="botaologin" onclick="check(this.form)" type="button">Entrar</button>
<button id="botaologin" onclick="registoTXT()" type="button">Registar</button>
</div>
</div>
</div>
</div>
</div>
</form>
</blockquote>
</div>