Anna wrote on 18 jan 2005 in comp.lang.javascript
:
Hi, I have disabled a checkbox and a the lable for that (text in a
<td>)
<td class="label" width="90" id="recalc" disabled>Recalculate
price</td>
<td><input type="checkbox" name="cbRecalc" tabindex="3" size="15"
maxlength="35" value="<%=sRecalc%>" disabled>
<td> does not "do" anything anyway,
so disabling a <td> is a false concept.
Perhaps you want to make a <tr> content invisible or non-displaying?
The containing checkbox wil not be available to change then,
and probably does not have to be disabled.
Try this:
================================================== ===
<table border=1>
<tr><td>=======</td><td>=======</td></tr>
<tr id="myTr1"><td>Recalculate price</td><td>
<input type="checkbox" value="<%=sRecalc%>">
</td></tr>
<tr><td>=======</td><td>=======</td></tr>
<tr id="myTr2"><td>Recalculate price</td><td>
<input type="checkbox" value="<%=sRecalc%>">
</td></tr>
<tr><td>=======</td><td>=======</td></tr>
</table>
<button onclick="hide()">Hide/show</button><br>
<button onclick="noDisplay()">Nodispaly/display</button><br>
<script type="text/javascript">
var myTr1 = document.getElementById("myTr1");
var hide1=false;
var myTr2 = document.getElementById("myTr2");
var ndis1=false;
function hide(){
hide1 = !hide1
myTr1.style.visibility=(hide1)?"hidden":"visible"
}
function noDisplay(){
ndis1 = !ndis1
myTr2.style.display=(ndis1)?"none":"block"
}
</script>
================================================== ====
--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)