pd. me gustaria tambien meter un nuevo campo de repetir contraseña q verifique si son iguales o no y largue un msj .
<html>
<head>
<script>
function cargarModo(){
modo=formCli.txtmodo.value;
validoForm();
}
function validoForm(){
if (validoCamposOblig()== 1 ){
alert ("Se ha registrado correctamente");
document.formCli.submit();
}else{
}
}
//aca agrego los campos q estan en el formulario q no pueden ser vacios , son iguales a como los llame en el formulario
function validoCamposOblig(){
if (formCli.usuario.value == "" ){
alert ("Ingrese el nick");
//pongo comentario aca porq con esto no anda bien pero asi es como tengo
else if (formCli.pass.value == ""){
//alert ("Ingrese el pass");
return 0;
}else{
return 1;
}
}
function validarEmail(){
var valor = formCli.mail.value;
if( !(/\w{1,}[@][\w\-]{1,}([.]([\w\-]{1,})){1,3}$/.test(valor)) ) {
alert ("El mail debe contener @ y . (punto), y el formato debe ser ejemplo [email protected]");
formCli.mail.focus();
return 0;
} else {
return 1;
}
}
function validarPassword(){
var res=0;
var largo= formCli.pass.value.length;
return res;
}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"><style type="text/css">
<!--
body,td,th {
color: #FFFFFF;
}
body {
background-color: #000066;
}
a:link {
color: #FFFFFF;
text-decoration: none;
}
a:visited {
color: #FFFFFF;
text-decoration: none;
}
a:hover {
color: #FF0000;
text-decoration: none;
}
a:active {
color: #FF0000;
text-decoration: none;
}
.Estilo1 {color: #FFFF00}
a {
font-size: 24px;
}
-->
</style>
</head>
<body >
<h1 class="Estilo1">Registro de usuario </h1>
<p class="Estilo1">* DATOS OBLIGATORIOS</p>
</head>
<body>
<td align="center" valign="top" class="subir Estilo1"><div align="center"><span class="Estilo7">Ir a :<a href="../../index.php"> Home </a></span></div></td>
<form name="formCli" method="post" action="../usuariosInsertar.php">
<table width="352" border="0">
<tr>
<td height="48" colspan="8"><div align="center" class="Estilo1"></div></td>
</tr>
<td>Nick::
<td><input name="usuario" type="text" id="usuario" />
*</td>
</tr>
<td> Password:<td><input name="password" type="password" id="pass" value="" >
*</td>
</tr>
<td> Mail:<td><input name="mail" id="mail">
*</td>
<!--salto de linea--></tr>
<td> Fecha:<td><select name="fechaNac" id="fechaNac">
<option value="1920">1920</option>
<option value="1921">1921</option>
</select>
</td>
</tr>
<tr>
<td colspan="3"><label>
<input type="button" value="Enviar" onClick="cargarModo()" >
<input type="hidden" size="2" name="txtmodo" value="">
</label></td>
</tr>
</table>
</form>
</body>
</html>