Jump to content

[Resolvido] Validar campos


leoretorico

Recommended Posts

Boa tarde amigos!

Como posso no código abaixo acrescentar uma mensagem se os campos não estiverem preenchidos?E no campo senha(password) ocultar os dados digitados com **** ???

<script type="text/javascript">

<!--

function authPass(u,p) {

if (u && p) self.location = "auth.htm?" + u + p;

return false;

}

// -->

</script>

<div>

<script type="text/javascript">

<!--

if (location.search.indexOf("auth=failed") != -1) {

document.write("<span style=\"color:#ff0000\">Acesso negado! Verifique seu login</span>");

}

// -->

</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="text" name="pass" /></td>

</tr>

<tr>

<td colspan="4" align="left"><input type="submit" value="Login" /><input type="button" name="reset_form" value="Limpar campos" onclick="this.form.reset();" /></td>

</tr>

</table>

</form>

</div>

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
×
×
  • 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.