473,795 Members | 2,974 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.c om\">GET FLASH BANNERS FOR FREE. WEBSITE INTERFACES DONE FOR FREE.</a>";
if(display==="t ext")
{
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="presen t(document.link 1.getlink.value )" />
<textarea rows="4" cols="35" name="getlink1" ></textarea>
</form>[/HTML]
Dec 25 '07 #1
3 7879
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.c om\">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="presen t(document.link 1.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
23891
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"> <input type="submit" name="mainform_action" value="Delete Data"> If the first radio button is selected, I only want all three buttons to be visible to the user. If the second radio button is selected, I only want the "Edit Data" and "View Data"...
6
4649
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 does so far and is failing to do ******************************* <?php session_start(); header("Cache-control: private"); //IE 6 Fix include("myconn.php");
4
21018
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 PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
6
5739
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 these terms and conditions. The part which I am struggling to find information online about is how to only activate the radio button (ie, prior to this event its disabled) when the user has scrolled to the bottom of the textarea.
18
25007
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, that IE7 does not seem to offer any way to control the font size of a text input element.
4
2292
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 in the radio button. Also I need to hide some check boxes based on the selected value. The checkboxes and radiobuttons are both server controls. Please let me know. Thanks,
1
1964
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 retrive their vakue on button click. The form is added in a div which is present in html form (that is not dynamically created). Form & all other elements are created dynamically & appended to div elemetn whch is present in html. The code is : ...
4
3031
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. <form action="" method="get"> <div align="center"> <table border="0" cellspacing="0" cellpadding="0">
1
2574
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 disabled and the radio button selection enables the needed text boxes. It works but... I don't want to see the text boxes unless they are needed and I want the user to be able to change their mind. (ie choose three images or go back to one image)...
0
9672
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9519
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10439
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10215
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10165
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10001
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5563
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4113
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3727
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.