473,325 Members | 2,774 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

how do you display values in a textarea using javascript

How do you display values in a textarea using javascript.

ex. i have 2 radio buttons

o Adult =$9.99
o Child =$6.99

i need it to be, so that if i select adult in the radio button option , it will display 9.99 in my textarea at the other frame. Cause im using 2 frames for this html file. The radio buttons are at the left frame and the textarea is at the right frame.
Dec 6 '06 #1
1 2116
acoder
16,027 Expert Mod 8TB
Expand|Select|Wrap|Line Numbers
  1. function setTextAreaVal(val) {
  2.     //First of all, you need to access the right frame.
  3.     //assuming the name of the frame is "right".
  4.     var frame = top.right;
  5.     // Then you need to access the textarea.
  6.     //If using the ID
  7.     var textarea = document.getElementById("textarea");
  8.     //Alternatively, if using the name, you also need the form name, e.g.
  9.     //var textarea = document.forms[formname].elements[textareaname];
  10.     //Finally, set the value using the value property.
  11.     textarea.value = val;
  12. }
Call the function onclick, e.g. onclick="setTextAreaVal(this.value)".
Jun 2 '08 #2

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

Similar topics

4
by: hoke | last post by:
I want to display plain text files in the browser. The files contain html and javascript and have a .txt extension. This works fine with files with just html. Unfortunately when showing files with...
5
by: Richard | last post by:
I am filling a TEXTAREA with text and links from a database. I need to display the <a href....> code in the TEXTAREA as a clickable link with _blank targetting. I realise I could simply use a TD...
19
by: dmiller23462 | last post by:
Hi guys....I have absolutely NO IDEA what I'm doing with Javascript but my end result is I need two text boxes to stay hidden until a particular option is selected....I've cobbled together the...
6
by: tony wong | last post by:
i wish to count number of characters in textarea box during typing in and display it somewhere in html page. so the number will increase during writing. is it possible to do it by javascript? ...
2
by: Jake Barnes | last post by:
Imagine I've this block of HTML: <p>Alex Schein Mailing List <input type="checkbox" name="newslettersToUse" value="133156"> (<a href="mcControlPanel.php"...
3
by: jiayanxiang | last post by:
Is there any sample code to use Javascript to load and display a text file? It will be best if the user can select files using some kind of explorer. If that's complex, a text box to specify the...
2
by: xhe | last post by:
I met a very headache problem in javascript, I think this might be difference between IE and NS / Safari. I have a text area <form> <textarea name='tex1' onkeyup='displayit();'></textarea>...
9
by: Ajinkya | last post by:
Hello friends ! , I am very new to java script.If anyone can help me then I will be very very thankful to his/her. I am using php and mysql in my project and I have one textarea and one...
1
by: lihao0129 | last post by:
The scenario is a RTF(Rich Text Format) editor where I can input text and meanwhile display 'style'd text or multimedia( i.e bold fonts, pictures, movies ) in the same box... I am currently...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.