Welcome to WebmasterWorld Guest from 3.227.3.146

Forum Moderators: open

Message Too Old, No Replies

disable checkboxes with the click of a button

     
10:06 pm on Jan 9, 2004 (gmt 0)

Full Member

10+ Year Member

joined:July 11, 2003
posts:232
votes: 0


Does anyone know how to disable a certain pair of checkboxes if a particular radio button is pressed?
10:55 pm on Jan 9, 2004 (gmt 0)

Full Member

10+ Year Member

joined:Nov 17, 2002
posts:313
votes: 0


Hi,

<HTML>
<HEAD>
<STYLE>
</STYLE>
<SCRIPT>
function skip () { this.blur(); }
function disableTextField (field) {
if (document.all ¦¦ document.getElementById)
field.disabled = true;
else {
field.oldOnFocus = field.onfocus;
field.onfocus = skip;
}
}
function enableTextField (field) {
if (document.all ¦¦ document.getElementById)
field.disabled = false;
else {
field.onfocus = field.oldOnFocus;
}
}
</SCRIPT>
</HEAD>
<BODY>
<FORM NAME="aForm">
<INPUT TYPE="text" NAME="aField" VALUE="Kibology">
<INPUT TYPE="button" VALUE="disable field"
ONCLICK="disableTextField(this.form.aField)"
>
<INPUT TYPE="button" VALUE="enable field"
ONCLICK="enableTextField(this.form.aField)"
>
</BODY>
</HTML>

This uses buttons to enable and disable a field, a little bit of tinkering should make the radio buttons do it. This is a subject I have literally just started researching.

wruk999