Jump to content

Chamar duas funções em um método


leoretorico
 Share

Recommended Posts

Boa tarde sou novo em Html e javascript

Tenho o código abaixo , um login sem base de dados..ele usa arquivos de texto.

Preciso pegar o nome do usuário digitado quando o login for correto e passar para outra página html ..para verificar se este usuário está logado .

Seria usando o method get? como posso implementar?

<script>
function click() {
 if (event.button==2||event.button==3) {
   oncontextmenu='return false';
 }
}
document.onmousedown=click
document.oncontextmenu = new Function("return false;")
</script>

<script type="text/javascript">
<!--
function authPass(u,p) {
 if (u && p) self.location = "Auth.html?" + u + p;
 return false;
}
// -->
</script>

<form id="form1" action="javascript://" onsubmit="return authPass(this.user.value,this.pass.value)"><table>
<tr>
<td>Usuário: </td><td><input type="text" name="user" /></td>
</tr>
<tr>
<td>Senha: </td><td><input type="password" name="pass" /></td>
</tr>
<tr>
<td colspan="4" align="left"><input type="submit" value="Entrar .." /><input name="Lembrar" type="button" onclick="window.open('hhttp://www.portugal-a-programar.pt/')" value="Recuperar a senha" /></td>
</tr>
</table>
</form>

Eu encontrei este código na web ... funciona perfeitamente ... mas não sei implementar no código acima!

<form action="HTML.html" method="GET">
<textarea rows="7" cols="30" name="text"></textarea>
<button type="submit">send</button>
</form>

HTML.html:

<script type="text/javascript">
window.onload = function () {
	document.write(window.location.search.split('=')[1]);
};
Link to comment
Share on other sites

decide-te o que queres, no primeiro post dizes uma coisa e agora dizes uma coisa diferente...

Tenho o código abaixo , um login sem base de dados..ele usa arquivos de texto.

Preciso pegar o nome do usuário digitado quando o login for correto e passar para outra página html ..para verificar se este usuário está logado .

Eu só preciso pegar a string do USERNAME e passar para uma outra página quando você apertar o botão

Username = Leo página1.html >>>>>>>>> pagina2.html / label = leo

Edited by Devexz

Contador de calorias: caloriaspordia.com

Link to comment
Share on other sites

Podes utilizar um cookie.

“There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult.”

-- Tony Hoare

Link to comment
Share on other sites

Mais uma vez: usa um cookie.

“There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult.”

-- Tony Hoare

Link to comment
Share on other sites

http://www.w3schools.com/js/js_cookies.asp

// Escrever para um cookie:
document.cookie="username=John Doe";

// Ler do cookie
var x = document.cookie;

“There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult.”

-- Tony Hoare

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.