Ver Mensaje Individual
  #8 (permalink)  
Antiguo 02/03/2007, 02:07
Avatar de JavierB
JavierB
Colaborador
 
Fecha de Ingreso: febrero-2002
Ubicación: Madrid
Mensajes: 25.052
Antigüedad: 23 años, 1 mes
Puntos: 772
Re: bloquear campos de formulario

Hola imasumaq

Prueba este código:

Código PHP:
<html>
<
head>
<
script type="text/javascript">
function 
cambiar(clase) {
  for (
i=0ele=document.forms[0].elements[i]; i++)
    if (
ele.type=='text')
      
ele.disabled = (ele.className!=clase);
}
</script>
</head>
<body>
<form>
<input type="radio" name="rad" checked="checked" onclick="cambiar('estu')" />Estudiantes<br />
<input type="radio" name="rad" onclick="cambiar('prof')" />Profes<br />
<input type="text" class="estu" />
<input type="text" class="estu" />
<input type="text" class="prof" disabled="disabled" />
<input type="text" class="prof" disabled="disabled" />
</form>
</body>
</html> 
Saludos,