Foros del Web » Programando para Internet » Javascript »

Fieldset

Estas en el tema de Fieldset en el foro de Javascript en Foros del Web. Hola Amigos del Foro. Necesito saber si se puede inhabilitar los componentes o elementos que estan en un fieldset, haciendo solo referencia a id o ...
  #1 (permalink)  
Antiguo 23/11/2005, 14:00
Avatar de myconatani  
Fecha de Ingreso: enero-2004
Ubicación: Pje.Ralún 8955 Santiago
Mensajes: 73
Antigüedad: 20 años, 3 meses
Puntos: 1
Fieldset

Hola

Amigos del Foro.

Necesito saber si se puede inhabilitar los componentes o elementos que estan en un fieldset, haciendo solo referencia a id o al name del fieldset. Esta inhavilitacion debe ser para los elementos de tipo: text, checkbox, radio, List Box, etc.



atte.
myconatani
__________________
myconatani
  #2 (permalink)  
Antiguo 23/11/2005, 14:58
Avatar de Saruman  
Fecha de Ingreso: mayo-2003
Ubicación: Panama city, Panama, Panama
Mensajes: 1.154
Antigüedad: 21 años
Puntos: 5
espero te sirva...

saludos

Código HTML:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<script language="javascript">
function Desactivar() { 
 var myfieldset = document.getElementById("MyFieldSet"); 
 if (myfieldset) {
  if (myfieldset.hasChildNodes()) { 
   for (var i=0; i < myfieldset.childNodes.length; i++) {
    var tipo = myfieldset.childNodes[i].type;
    if (tipo == "button" || tipo == "checkbox" || tipo == "radio") { //agrega aqui otros tipos de objetos.....
     myfieldset.childNodes[i].disabled = true;
    }
   }
  } 
 } 
} 
</script>
<body onLoad="Desactivar()">
<fieldset id="MyFieldSet">
<input type="button" value="Botón">
<input type="checkbox" value="1">
<input type="radio" value="1">
</fieldset>
</body>
</html> 
__________________
Saruman

One Ring to rule them all, One Ring to find them, One Ring to bring them all and in the darkness bind them.
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 23:27.