
habilitar campo de texto
Publicado por Marco (1 intervención) el 25/11/2013 03:25:57
que tal no se mucho de javascript necesito habilitar "n" campos de tipo text al darle click en un raddio button en html PERO solo me lo habilita cuando tengo uno, si tengo mas de 1 no lo habilita este es mi script:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<html>
<head>
<script language="JavaScript">
function habilita(){
document.frm.txt.disabled = false;
}
function deshabilita(){
document.frm.txt.disabled = true;
document.frm.txt.value = "";
}
</script>
</head>
<body>
<form name='frm'>
<b>Sexo:</b><br>
<input type="radio" name="rad" value="M" onclick="deshabilita()">
Masculino<br>
<input type="radio" name="rad" value="F" onclick="deshabilita()">
Femenino<br>
<input type="radio" name="rad" value="O" onclick="habilita(this.frm.txt)">
Otro (Indique cual:
<input type='text' name='txt' disabled>
<input type='text' name='txt' disabled>
</form>
</body>
</html>
Valora esta pregunta


0