Código PHP:
<form name="formularioDM">
<table>
<tr>
<td>¿Vive con DM? </td>
<td>
<span id="ViveDM" rel="d1,dis,c1,c2,c3,c4,c5">
Si<input type="radio" name="ViveDM" value="0">
No<input type="radio" name="ViveDM" value="1" checked="1">
</span>
</td>
<td> </td>
</tr>
<tr>
<td>Tipo de DM:</td>
<td><input name="d1" type="radio" value="DM1" />
DM1
</td>
<td><input name="d1" type="radio" value="DM2" />
DM2</td>
</tr>
<tr>
<td> </td>
<td><input name="d1" type="radio" value="Gestacional" />
Gestacional</td>
<td><input name="d1" type="radio" value="Nose" />
No sé </td>
</tr>
<tr>
<td colspan="3">¿Tiene familiares que viven con DM?
<span id="Fams" rel="c1,c2,c3,c4,c5">
Si<input type="radio" name="dis" value="0" >
No<input type="radio" name="dis" value="1" checked="1">
</span>
<br>
<input type="checkbox" name="c1" value="hijo" >
Hijo(a)
<br>
<input type="checkbox" name="c2" value="padre" >
Padre<br>
<input type="checkbox" name="c3" value="madre" >
Madre<br>
<input type="checkbox" name="c4" value="esposo" >
Esposo(a)<br>
<input type="checkbox" name="c5" value="abuelo" >
Abuelo(a)<br>
<input type="checkbox" name="other" value="other" title="Otros" > <input type="text" name="c6" size="12" >
</td>
</tr>
</table>
</form>
<script>
(function(form){
var d = document, f = d[form], g = f.elements, i, x
var inArray = function(e,a) {for(i=0;i<a.length;i++){if(a[i]===e){return i}}return -1}
var Inputs = function(e){return e.getElementsByTagName('input')}
var Get = function(id){return d.getElementById(id)}
var onOff = function(s,dis){
s = s.split(/,/g) //Convertir en array los elementos del primer parámetro
for(x=0;x<g.length;x++){
if(inArray(g[x].name,s) > -1) g[x].disabled = !dis // Habilitar/Deshabilitar
}
}
Get("ViveDM").onclick = function(){ //¿Vive con DM? Si/No
onOff('d1,dis',Inputs(this)[0].checked) //habilitar Tipo DM / Familiares con DM
onOff('c1,c2,c3,c4,c5,c6,other',Inputs(this)[0].checked && Inputs(Get("Fams"))[0].checked) //habilitar cuadros Familiares SI el Check familiares esta en "Si"
}
Get("Fams").onclick = function(){ //¿Tiene familiares que viven con DM? Si/No
onOff('c1,c2,c3,c4,c5,other',Inputs(this)[0].checked)
onOff('c6',Inputs(this)[0].checked && f.other.checked)
}
f.other.onclick = function(){ //habilitar cuadro "otros" de Familiares
onOff('c6',this.checked)
}
onOff('d1,dis,c1,c2,c3,c4,c5,c6,other',false) // deshabilitar todo
})("formularioDM") // nombre formulario
</script>
En el código te explico como funciona y es mas corto, claro, si quieres una modificación me avisas. Un saludo.