<script language="javascript">
function checkAll(oForm, cbName, checked) {
for (var i=0; i < oForm[cbName].length; i++) {
oForm[cbName][i].checked = checked;
update(oForm[cbName][i], 'text' + oForm[cbName][i].value);
}
}
function update(checkObj,textID) {
var textObj = document.getElementById(textID);
textObj.style.visibility = checkObj.checked?'visible':'hidden';
}
</script>
<form id="frm">
<table>
<tr>
<td>
<label><input type="checkbox" name="total" value="id" onClick="checkAll(document.getElementById('frm'), 'chk', this.checked)"> Check all</label>
</td>
</tr>
<tr>
<td><input name="chk" type="checkbox" id="a" value="1" onclick="update(this,'text1')"></td>
<td> <input type="text" id="text1" style="visibility:hidden;"> </td>
</tr>
<tr>
<td> <input name="chk" type="checkbox" id="b" value="2" onclick="update(this,'text2')"> </td>
<td> <input type="text" id="text2" style="visibility:hidden;"> </td>
<tr>
<td> <input name="chk" type="checkbox" id="c" value="3" onclick="update(this,'text3')"> </td>
<td> <input type="text" id="text3" style="visibility:hidden;"> </td>
<tr>
<td> <input name="chk" type="checkbox" id="d" value="4" onclick="update(this,'text4')"> </td>
<td> <input type="text" id="text4" style="visibility:hidden;"> </td>
</table>
</form>