473,503 Members | 5,284 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Show text in textarea based on selected radio button

1 New Member
hi guys,

see i want to develop a script and developed one but it s not working. the concept is there will be three radio buttons. the user has to check one radio button and click the button next to it. there will be a text area below that as soon as the submit button is clicked based on what radio button is clicked the text should appear in the text area.

this is script what i created

[HTML]function present(display)
{
var text1="<a href=\"http://www.cybetrone.com\">GET FLASH BANNERS FOR FREE. WEBSITE INTERFACES DONE FOR FREE.</a>";
if(display==="text")
{
document.write(link1.getlink1.value)==text1;
}

<form name="link1" action="" method="post">
<input type="radio" name="getlink" value="text" />TEXT LINK
<input type="radio" name="getlink" value="banner1" />468*60 BANNER
<input type="radio" name="getlink" value="banner2" />400*20 BANNER
<input type="button" value="get code" onclick="present(document.link1.getlink.value)" />
<textarea rows="4" cols="35" name="getlink1"></textarea>
</form>[/HTML]
Dec 25 '07 #1
3 7788
Cainnech
132 New Member
Hi Santosh,

I think this is what you're looking for?

Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <head>
  3. <script type="text/javascript">
  4. <!--
  5.  
  6. function display() {
  7.  
  8. document.link1.getlink[0].value = '<a href="http://www.cybetrone.com">GET FLASH BANNERS FOR FREE. WEBSITE INTERFACES DONE FOR FREE.</a>';
  9. document.link1.getlink[1].value = '<a href="http://www.cybetrone.com"><img src="some_image.jpg" border="0" />GET FLASH BANNERS FOR FREE. WEBSITE INTERFACES DONE FOR FREE.</a>';
  10. document.link1.getlink[2].value = '<a href="http://www.cybetrone.com"><img src="some_other_image.jpg" border="0" />GET FLASH BANNERS FOR FREE. WEBSITE INTERFACES DONE FOR FREE.</a>';
  11.  
  12. for (var i=0; i < 3; i++)
  13.    {
  14.    if (document.link1.getlink[i].checked)
  15.       {
  16.       document.link1.output.value = document.link1.getlink[i].value;
  17.       }
  18.    }
  19. }
  20.  
  21.  
  22. //-->
  23. </script>
  24. </head>
  25. <body>
  26.  
  27. <form name="link1" action="" method="post">
  28. <input type="radio" name="getlink" />TEXT LINK
  29. <input type="radio" name="getlink" />468*60 BANNER
  30. <input type="radio" name="getlink" />400*20 BANNER
  31. <input type="button" value="get code" onclick="javascript:display()" />
  32. <textarea rows="4" cols="35" name="output"></textarea>
  33. </form>
  34. </body>
  35. </html>
  36.  
greets
Dec 26 '07 #2
acoder
16,027 Recognized Expert Moderator MVP
Please remember to provide a meaningful Title for any threads started (see the FAQ entry Use a Good Thread Title).

This helps to ensure that other members, and also the general public, will have a better chance of finding answers to any similar questions.

MODERATOR
Dec 26 '07 #3
acoder
16,027 Recognized Expert Moderator MVP
see i want to develop a script and developed one but it s not working. the concept is there will be three radio buttons. the user has to check one radio button and click the button next to it. there will be a text area below that as soon as the submit button is clicked based on what radio button is clicked the text should appear in the text area.

this is script what i created
Your script has a few problems. You didn't close the function. Is the JavaScript within script tags? You can't use document.write after the page has loaded.

[HTML]<script type="text/javascript">
function present(display)
{
var text1="<a href=\"http://www.cybetrone.com\">GET FLASH BANNERS FOR FREE. WEBSITE INTERFACES DONE FOR FREE.</a>";
if (display=="text")
{
document.forms["link1"].getlink1.value = text1;
}
}
</script>
<form name="link1" action="" method="post">
<input type="radio" name="getlink" value="text" />TEXT LINK
<input type="radio" name="getlink" value="banner1" />468*60 BANNER
<input type="radio" name="getlink" value="banner2" />400*20 BANNER
<input type="button" value="get code" onclick="present(document.link1.getlink.value)" />
<textarea rows="4" cols="35" name="getlink1"></textarea>
</form>[/HTML]
Dec 26 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

3
23851
by: Owen Funkhouser | last post by:
I have a form with three radio options. And I have three buttons: <input type="submit" name="mainform_action" value="Edit Data"> <input type="submit" name="mainform_action" value="View Data">...
6
4620
by: Ian Davies | last post by:
Hi me again, sorry to be a pain. Ive been struggling with this one all day. Hope you can understand whats happening. First my script is below. Have a look and I'll explain at the bottom what it...
4
20989
by: devine | last post by:
Hi All, I am VERY new to Javascript. I have been provided with some code, which will enable me to hide/show a text area and change a submit button dependant on a check box. <!DOCTYPE html...
6
5702
by: Rob | last post by:
Hi all, I would like to have a textarea control on my web page that is complete with terms and conditions, in addition, I would like a radio button beneath this to indicate the acceptance of...
18
24929
by: Diogenes | last post by:
Hi All; I, like others, have been frustrated with designing forms that look and flow the same in both IE and Firefox. They simply did not scale the same. I have discovered, to my chagrin,...
4
2273
by: =?Utf-8?B?U3JpZGhhcg==?= | last post by:
Hi, Is it possible to Hide/Show controls during a callback? I have a radio button list that does the callback. When it does the callback I need to refresh the grid to reflect the selected value...
1
1942
by: truptidalia | last post by:
Hello, I am trying to add 2 RadioButtons in a form in js dynamically. I can see 2 radiobutttons, but no text. On clicking them, their is no selection. One of them is selected. I need to...
4
3014
by: pureadrenaline | last post by:
Hey Guys, Please could anyone help me out with the following form I need to create a validation on the email field only if the user checked the radio button named Email. Thanks in advance. ...
1
2550
by: stewdizzle | last post by:
I have a from with three radio buttons (same group) and three text boxes. The radio buttons give the user a choice of uploading one, two, or three images. Currently, I have the text boxes load as...
0
7070
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7267
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7316
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7449
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
4993
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4666
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3160
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
729
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
372
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.