<input type='checkbox' name='chk1' value='1'
onclick='enable_txtbox("item","item1")'>name<br>
<input type='text' name='name1' id='item' disabled='disabled'><input type='text'
name='name1' id='item1' disabled='disabled'><input type='text' name='name1' id='item2'
disabled='disabled'>
<script>
function enable_txtbox(id,id1)
{if(document.getElementById(id).disabled == true)
{
document.getElementById(id).disabled = false;
} else
{document.getElementById(id).disabled = true; }
return true;}
</script>
答案 0 :(得分:0)
use this:
<script>
function enable_txtbox(id, id1) {
var a =(document.getElementsByName("name1"));
for(var i=0;i<a.length;i++){
var b=a[i].id;
if(document.getElementById(b).disabled == true)
{
document.getElementById(b).disabled = false;
}
else
{
document.getElementById(b).disabled = true;
}
}
return true;
}
</script>