-4
I want when you log in, the other form appears but it appears by a second frame and disappears, why ?? someone please help me ?
<html>
<head>
</head>
<body>
<form onsubmit="return Verifica(this)">
<span> Login:</span><input type="text" value="" name="usuario" id="login" >
<span> Senha:</span> <input type="password" name="senha" value="" id="senha" >
<input type="submit">
</form>
<script>
function Verifica(form){
var user = form.usuario.value;
var pass = form.senha.value;
if( user == "1" && pass == "2"){
alert("Sucesso");
Visible();
}else{
alert("Falho");
return false;
}
}
function Visible(){
document.getElementById("tipo").style.visibility = "visible";
document.getElementsByName("raca").style.visibility = "visible";
document.getElementByName("descricao").style.visibility = "visible";
document.getElementsByName("submit").style.visibility = "visible";
document.getElementById("login").style.visibility = "hidden";
document.getElementsById("senha").style.visibility = "hidden";
}
</script>
<form action="cad.php" method="post" name="form">
<input type="text" id="tipo" name="tipo" value="" style="visibility: hidden;" >
<input type="text" name="raca" value="" style="visibility: hidden;">
<textarea name="area" style="visibility: hidden;"><input type="text" name="descricao" value=""></textarea>
<input type="submit" name="submit" value="submit" style="visibility: hidden;">
</form>
<script>
function Visible(){
document.getElementById("tipo").style.visibility = "visible";
document.getElementsByName("raca").style.visibility = "visible";
document.getElementByName("descricao").style.visibility = "visible";
document.getElementsByName("submit").style.visibility = "visible";
document.getElementByName("usuario").style.visibility = "hidden";
document.getElementsByName("senha").style.visibility = "hidden";
}
</script>
</body>
</html>
I recommend studying some more and analyzing the code. There is a lot of strange stuff. An input within a textarea? Login data in Javascript? Why not hide/show the whole form instead of each element within it? The problem is not that the second form is "appearing and disappearing fast", it is because you are submitting the first and the page is being reloaded.
– Sam
really had a lot of weird stuff, thank you so much I re-read everything and fixed everything =)
– lincoln ferreira