Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Loading Text into a TEXTAREA

Posted on 1998-08-17
8
199 Views
Last Modified: 2010-04-09
I have defined a TEXTAREA in IE3 and want to pass text to that textarea.

So far I have the following (which works in IE4)

<SCRIPT>
{
var s0 = "Text Var zero. "
var s1 = "Text Var one. "
var s2 = "Text Var two. "
}</SCRIPT>

and in the body -

<TEXTAREA NAME="box" ROWS="6" COLS="53" WRAP="VIRTUAL"></TEXTAREA>

I thought that if I called "box.value = s0; " it would pass "Text Var zero." to the TEXTAREA.

It does in IE4 but in IE3 I get a  "'box' is undefined" error

Any ideas??
0
Comment
Question by:cmuir
8 Comments
 
LVL 4

Expert Comment

by:martinag
ID: 1836761
<FORM NAME="form">
<TEXTAREA NAME="box" ROWS="6" COLS="53" WRAP="VIRTUAL"></TEXTAREA>
</FORM>

Reference to box using document.form.box ie
document.form.box.value = s0;

Martin
0
 

Author Comment

by:cmuir
ID: 1836762
Tried document.form.box.value No error msg
But
TEXTAREA remains blank!
0
 
LVL 4

Expert Comment

by:martinag
ID: 1836763
Strange...
Maybe that you can not set the text, just read it.
Try this:
alert(document.form.box.value);

Does it display the text in the TEXTAREA?

Martin
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 4

Expert Comment

by:martinag
ID: 1836764
Found this in the documentation:

The value property is a string that initially reflects the VALUE attribute. This string is displayed in the text and textarea fields. The value of this property changes when a user or a program modifies the field.

You can set the value property at any time. The display of the text and textarea objects updates immediately when you set the value property.

Maybe there is a bug in IE3? That is where the problem occurs, right?
I guess your script still works in IE4.

Martin
0
 
LVL 10

Accepted Solution

by:
MasseyM earned 20 total points
ID: 1836765
Here you go, this works:

*************************************

<SCRIPT>
{
var s0 = "Text Var zero. " 
var s1 = "Text Var one. " 
var s2 = "Text Var two. " 
}</SCRIPT>

<FORM Name="Name">
<TEXTAREA NAME="box" ROWS="6" COLS="53" WRAP="VIRTUAL">
</TEXTAREA>
<A HREF="javascript:GoText()">Click Me</A>

<SCRIPT>
function GoText(){
document.Name.box.value = s0

}
</SCRIPT>
</FORM>

******************************************
0
 
LVL 4

Expert Comment

by:martinag
ID: 1836766
MasseyM,
exactly which part of that answer did you come up with by yourself?
The only new thing is the name of the form.

Martin
0
 
LVL 8

Expert Comment

by:jbirk
ID: 1836767
Get used to it martinag.  MasseyM does this all the time.

The only thing I can think of which may fix this is changing the names in the off chance that form or box are reserved in IE 3 for some unknown reason and are causing a problem.  Otherwise it's just an error in the browser, and yet another good reason for IE 3 users to download a real browser!
-Josh
0
 
LVL 4

Expert Comment

by:martinag
ID: 1836768
Thanks for the advice...

Martin
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question