Ver Mensaje Individual
  #3 (permalink)  
Antiguo 07/05/2007, 08:58
Avatar de JavierB
JavierB
Colaborador
 
Fecha de Ingreso: febrero-2002
Ubicación: Madrid
Mensajes: 25.052
Antigüedad: 22 años, 3 meses
Puntos: 772
Re: ¿Como habilitar con un botón campos de texto inicialmente deshabilitados?

Hola dandreta y karemlis

Un ejemplo:

Código PHP:
<html>
<
head>
<
script type="text/javascript">
function 
habilitar(frm) {
  for (
i=0ele frm.elements[i]; i++)
    if (
ele.type == 'text')
      
ele.disabled false;
}
</script>
</head>
<body>
<form>
<input type="text" disabled="disabled" />
<input type="text" disabled="disabled" />
<input type="text" disabled="disabled" />
<input type="button" onclick="habilitar(this.form)" />
</form>
</body>
</html> 
Para mostrar/ocultar un campo:

Código:
<form>
<form>
<input type="text" name="txt" style="display:none" />
<input type="button" onclick = "txt.style.display = 'block'" />
En lugar de block también puede usarse inline

Saludos,