enable a textlable with javascript

A

Anna

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>

When onChange on a drop down meny I whant to enable both of the above.
I have tried the following javascript. The checkbox is enabled, but
not the text in the table.

function enableCheckbox()
{
frmMain.cbRecalc.disabled = false;
frmMain.recalc.disabled = false;
}

Can someone please give me a suggestion of something that works :)
/Anna
 
E

Evertjan.

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>

======================================================
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,677
Members
48,796
Latest member
Greg L.

Latest Threads

Top