Ver Mensaje Individual
  #2 (permalink)  
Antiguo 25/09/2009, 07:19
Avatar de gjx2
gjx2
 
Fecha de Ingreso: agosto-2008
Ubicación: R.D
Mensajes: 1.153
Antigüedad: 16 años, 5 meses
Puntos: 139
Respuesta: Borrar input text relacionado con checkbox al deseleccionar

Código HTML:
Ver original
  1.    
  2. function seleccionar(){
  3.    
  4.     var chk = document.getElementById('añade1');
  5.        
  6.         if(chk.checked){
  7.                 rese();
  8.             document.getElementById('Inputs').style.display='none';
  9.         }
  10.         else
  11.         {
  12.         document.getElementById('Inputs').style.display='block';
  13.         }
  14.  
  15.     }
  16.  
  17.  
  18.     function rese(){
  19.        
  20.         document.getElementById('apellido1b').value = "";
  21.         document.getElementById('apellido2b').value = "";
  22.         document.getElementById('nombreb').value = "";
  23.     }
  24.  
  25.  
  26.  
  27.  
  28. <form name="comunicaciones">
  29. <input name="añade1" type="checkbox" id="añade1" onClick="seleccionar()">  
  30.       <div id="Inputs">
  31.    
  32.         <input name="apellido1b" type="text" id="apellido1b" size="18" >      
  33.         <input name="apellido2b" type="text" id="apellido2b" size="18">
  34.         <input name="nombreb" type="text" id="nombreb" size="15">
  35.        
  36.        </div>
  37.        
  38.        </form>