Current location: Hot Scripts Forums » General Web Coding » JavaScript » two radio button and one text area


two radio button and one text area

Reply
  #1 (permalink)  
Old 09-15-06, 03:36 AM
zoliky's Avatar
zoliky zoliky is offline
Aspiring Coder
 
Join Date: Jun 2006
Posts: 537
Thanks: 0
Thanked 0 Times in 0 Posts
two radio button and one text area

I have two radio button on HTML page. Each radio button has a name.
The first radio button is "No" and the second radio button is "Yes"

I have a text area on page. I want to lock text area if User select NO button, and allow text area if user select "Yes" radio button.

Is hard to do this ? Anyone help me with some idea?
Reply With Quote
  #2 (permalink)  
Old 09-15-06, 03:44 AM
Nico's Avatar
Nico Nico is offline
Community Leader
 
Join Date: Sep 2005
Location: Spain
Posts: 8,075
Thanks: 11
Thanked 88 Times in 83 Posts
Moved to Javascript.

EDIT:

Something like that?
Code:
<script type="text/javascript">

function enable_area(opt)
{
	document.form.textarea.disabled = (opt == 'yes' ? false : true);
}

</script>

<form action="" method="post" name="form">
Yes <input type="radio" name="radio" value="yes" onclick="enable_area(this.value);" />
No <input type="radio" name="radio" value="no" onclick="enable_area(this.value);" />
<br />
<textarea name="textarea"></textarea>
</form>

Last edited by nico_swd; 09-15-06 at 03:55 AM.
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump


All times are GMT -5. The time now is 11:16 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.