Remember Enable and Disable

[Total: 0    Average: 0/5]

This script allows you to enable and disable a formfield.

Body Code:

<script>
function showOtherTitle(){
        if (document.all||document.getElementById){
                document.forms.titleControl.textHere.disabled=false;
                if (document.forms.titleControl.titleFlag.value ==
'disabled'){
                        document.forms.titleControl.textHere.value='';
                }
                else{
                        document.forms.titleControl.textHere.value =
document.forms.titleControl.titleFlag.value;
                }
        }       
}
function hideOtherTitle(){
        if (document.all||document.getElementById){
                if (document.forms.titleControl.textHere.disabled == false){
                        document.forms.titleControl.titleFlag.value =
document.forms.titleControl.textHere.value;
                }
                document.forms.titleControl.textHere.disabled=true;
                document.forms.titleControl.textHere.value='disabled';
        }
}                       
</script>

<form name="titleControl">
<input name="titleFlag" type="hidden" value="disabled" />
<br>
<table>
<tr>
<td>Title:</td>
<td>Mr:</td>
<td><input name="radioButton" type="radio" value="mr"
onClick="hideOtherTitle();" /></td>
<td>Mrs:</td>
<td><input name="radioButton" type="radio" value="mrs"
onClick="hideOtherTitle();" /></td>
<td>Miss</td>
<td><input name="radioButton" type="radio" value="miss"
onClick="hideOtherTitle();" /></td>
<td>Other:</td>
<td><input name="radioButton" type="radio" value="other"
onClick="showOtherTitle();"/></td>
<td><input name="textHere" type="text" size="20" value="disabled" disabled
/></td>
</tr>
</table>
</form>

Times Viewed: 0

Leave a Reply

Your email address will not be published. Required fields are marked *