Ver Mensaje Individual
  #1 (permalink)  
Antiguo 26/09/2008, 12:08
Avatar de Quclii
Quclii
 
Fecha de Ingreso: julio-2008
Ubicación: Guadalajara
Mensajes: 76
Antigüedad: 16 años, 7 meses
Puntos: 0
Como le puedo hacer ?

hola

mi pregunta es como puedo hacerle para que en un textbox ponga un numero X y en base a eso en un textarea solo pueda meter solo ese numero de caracteres

Código:
<HTML>
<style type="text/css">
<!--
.Estilo1 {
	       font-family: "Lucida Console";
	       font-size: 12px;
         }
.Estilo2 {font-size: 12px}
.Estilo3 {font-family: "Lucida Console"}
-->
</style>

   <Script>
   
						 
      <!-- 
            function checkFields(){
                                    missinginfo = "";
                                    if (document.form1.archivo.value == ""){
                                                                             missinginfo += "\n     -  Nombre";
                                                                           }

                                    if (document.form1.numero.value == ""){
                                                                            missinginfo += "\n     -  Rango";
                                                                          }

                                    if(document.form1.datos.value == ""){
                                                                          missinginfo += "\n     -  Datos";
                                                                        }

                                    if (missinginfo != ""){
                                                            missinginfo = "Te ha faltado introducir los siguientes datos:\n" +
                                                            missinginfo + "\n¡Por favor rellena los datos y prueba de nuevo!";
                                                            alert(missinginfo);
                                                            return false;
                                                          }
                                                          else{
														        return true;
                                                              }
								 }
      //-->
	  
	  <!--
	              function checkFields1(){
                                           missinginfo = "";
                                           if (document.form2.abrir.value == ""){
                                                                                  missinginfo += "\n     -  Nombre";
                                                                                }

                                           if (missinginfo != ""){
                                                                   missinginfo = "Te ha faltado introducir los siguientes datos:\n" +
                                                                   missinginfo + "\n¡Por favor rellena los datos y prueba de nuevo!";
                                                                   alert(missinginfo);
                                                                   return false;
                                                                 }
                                                                 else{
														               return true;
                                                                     }
								         }
      //-->

     <!--
         var nav4 = window.Event ? true : false;
         function acceptNum(evt){
                                  var key = nav4 ? evt.which : evt.keyCode;	
                                  return (key <= 13 || (key >= 48 && key <= 57));
                                }
     //-->
	 
	         function maximaLongitud(numero,maxlong){ 
                                                      var tecla, in_value, out_value; 
                                                      if (numero.value.length > maxlong){ 
                                                                                          in_value = datos.value; 
                                                                                          out_value = in_value.substring(0,maxlong); 
                                                                                          datos.value = out_value; 
                                                                                          return false; 
                                                                                        } 
                                                      return true; 
                                                    }    esta es la funcion
   </Script>

   <Body>


       <form name="form1" method="post" action="Crear.php" onsubmit="return checkFields();">

             <p class="Estilo2"><span class="Estilo3">Nombre Archivo:</span> 
               <input type="text" name="archivo">
             </p>
             <p class="Estilo2 Estilo3">Numero de Datos a Ingresar:
               <input type="text" name="numero" onKeyPress="return acceptNum(event)">
             </p>
	           <p><span class="Estilo1">Ingresar Numeros Enteros:</span> 
               <textarea name="datos" cols="30" onKeyPress="return acceptNum(event)" onKeyUp="return maximaLongitud('numero')"></textarea>
             </p>
             <p> 
               <input type="submit" value="Guardar">
             </p>
			 
       </form>

   <form name="form2" method="post" action="Leer.php" onsubmit="return checkFields1();">
           
        <p><span class="Estilo2 Estilo3">MODO DE ABRIR EL ARCHIVO</span></p>
        <p>
           <input name="forma" type="radio" value="lectura" checked><span class="Estilo1">LECTURA
           <input name="forma" type="radio" value="modific">MODIFICAR</span>
	    </p>
        <p><span class="Estilo1">Nombre del Archivo:</span> 
           <input type="text" name="abrir">
           <input type="submit" value="Abrir">
        </p>
	 
   </Form>
       
   </Body>

</Html>

Última edición por Quclii; 26/09/2008 a las 16:26