Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Onclick event on a radio button

Status
Not open for further replies.

kruxty

Programmer
Jul 17, 2001
197
PT
It is possible to do a onclick event on a radio button?

I have a radio button and two text fields. I want to active those fields when i activate the radio button.

Is it possible?

Tkx to all help ;)
 
Hehe... very useful :p

Can you give me some examples to do this or an url
 
You can asssign an onclick handler to a radio button like this:

Code:
<input type="radio" onclick="someFunc();">

and thdn you can activate fields, or whatever else you want to do in your function:

Code:
function someFunc() {
   // do stuff here
}

Hope this helps,
Dan

Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
and how can i make the text field active or no active?
 
Then, assuming the field has an ID of "myField01", this would work:

Code:
document.getElementById('myField01').disabled = true;

You would set it to "false" to re-enable the field.

NOTE: Disabled fields do NOT get submitted with the form.

Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Thanks for the advice and for the help given

K.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top