...

View Full Version : disable input text



kalosneri
05-30-2005, 06:56 AM
i have 3 radio button.
1st radio button is checked.
when i clik another radio button i want to disable the input text.how?

kalosneri
05-30-2005, 07:03 AM
carik sendiri la, hahahaha

glenngv
05-30-2005, 07:29 AM
carik sendiri la, hahahaha
:confused: :confused: :confused:

kalosneri
05-30-2005, 08:36 AM
i have one input text and 3 radio button..
1st radio button is checked..
i want if i checked 2dn or 3rd radio button
that input text must be disable.
can u tell me how to do that???

glenngv
05-30-2005, 09:24 AM
Something like this?

<input type="radio" name="rad" id="rad1" value="1" checked="checked" onclick="this.form.txtOther.disabled=true" /><label for="rad1">Item 1</label>
<input type="radio" name="rad" id="rad2" value="2" onclick="this.form.txtOther.disabled=true" /><label for="rad2">Item 2</label>
<input type="radio" name="rad" id="rad3" value="3" onclick="this.form.txtOther.disabled=false;this.form.txtOther.focus()" /><label for="rad3">Other</label><input type="text" name="txtOther" />

Bill Posters
05-30-2005, 09:41 AM
e.g.

function doCheck(id) {
var myTextObj = document.getElementById('myText');
(document.getElementById(id).value == '01') ? myTextObj.disabled = false : myTextObj.disabled = true ;
}


<label for="rad01" onclick="doCheck('rad01');">Option 01
<input type="radio" name="rad" id="rad01" value="01" checked="checked" />
</label>

<label for="rad02" onclick="doCheck('rad02');">Option 02
<input type="radio" name="rad" id="rad02" value="02" />
</label>

<label for="rad03" onclick="doCheck('rad03');">Option 03
<input type="radio" name="rad" id="rad03" value="03" />
</label>

<input type="text" id="myText" value="default" />

kalosneri
05-30-2005, 10:07 AM
ok tq



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum