Solved

Loading Text into a TEXTAREA

Posted on 1998-08-17
8
187 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
 
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
In this Micro Tutorial viewers will learn how to create navigation buttons that change on rollover, using CSS (Continuation of the CSS Image Sprite tutorial) Create a parent ID for all the list items       - Specify position: absolute and display: block…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

706 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now