Ver Mensaje Individual
  #3 (permalink)  
Antiguo 07/04/2005, 07:26
Avatar de alexjnm
alexjnm
 
Fecha de Ingreso: octubre-2004
Ubicación: cuba
Mensajes: 218
Antigüedad: 20 años, 4 meses
Puntos: 1
ok

este es es script
Código HTML:
<script> 
//Script original de KarlanKas para forosdelweb.com 

    colorMal="#BCCFA9"; 
    colorBien="white"; 
     
    regla=new Array() 

    regla[0]="valor.length<3"; 
    regla[1]="valor.length<3";
	regla[2]="valor.length<3";
	regla[3]="valor.length<4";
	regla[4]="valor.length<6";
	regla[5]="isNaN(valor) || valor<600000000";
	regla[6]="isNaN(valor) || valor<300"; 
    regla[7]="valor.lastIndexOf('@')!=valor.indexOf('@') || valor.indexOf('@')<2 || valor.lastIndexOf('.')<valor.length-4 || valor.lastIndexOf('.')>valor.length-3"; 
	regla[8]="valor.length<5";
	regla[9]="valor.length<5"; 

    mensaje=new Array() 


    mensaje[0]="Por favor, introduzca el nombre"; 
    mensaje[1]="El número de teléfono introducido no es válido"; 
    mensaje[2]="correo inválido";
	mensaje[3]="Por favor, introduzca el Apellidos"; 
    function comprobar(){ 
    errores=""; 


    for(a=0;a<regla.length;a++){ 
    valor=document.forms[0].elements[a].value; 
    if(eval(regla[a])){ 
    errores+=mensaje[a]+"<br>"; 
    document.forms[0].elements[a].style.background=colorMal;} 
    else{document.forms[0].elements[a].style.background=colorBien;} 
    } 
    herror.style.background=(errores!="")?colorMal:colorBien; 
    herror.style.border=(errores!="")?"solid 1px black":"none"; 
    herror.innerHTML=errores; 
    } 
     
</script> 
esta es la parte de html
Código HTML:
<form name="form1" method="post" action="lolo.php">
                          
      <input name="nombre" type="text" class="formurigistro" id="nombre">
        <br>
        <input name="apellidos" type="text" class="formurigistro" id="apellidos">
        <br>
        <select name="pais" class="formurigistro" id="pais">
          <option value="cuba">Cuba</option>
        </select>
        <br>
        <input name="ciudad" type="text" class="formurigistro" id="ciudad">
        <br>
        <input name="direccion" type="text" class="formurigistro" id="direccion">
        <br>
        <input name="telefono" type="text" class="formurigistro" id="telefono">
        <br>
        <input name="zip" type="text" class="formurigistro" id="zip">
        <br>
        <input name="email" type="text" class="formurigistro" id="email">
        <br>
        <input name="password" type="password" class="formurigistro" id="password">
        <br>
        <input name="password1" type="password" class="formurigistro" id="password1"> 
        <input name="Submit" type="button" class="formurigistro" value="Enviar" onclick=comprobar()>
        <input name="Submit" type="reset" class="formurigistro" value="Restablecer">
        <br>
        <input name="uso" type="checkbox" id="uso" value="checkbox"> 
        Estoy de Acuerdo con las Condiciones de uso<br>
              </form> 
espero que me puedan ayudar
saludos alex
__________________
__________________________________________________ _________
A beses el camino mas largo es la solución mas eficaz :)