?
Solved

Loading Text into a TEXTAREA

Posted on 1998-08-17
8
Medium Priority
?
221 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
[X]
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
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
Video: Liquid Web Managed WordPress Comparisons

If you run run a WordPress, you understand the potential headaches you may face when updating your plugins and themes. Do you choose to update on the fly and risk taking down your site; or do you set up a staging, keep it in sync with your live site and use that to test updates?

 
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 40 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

Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.

Question has a verified solution.

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

This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
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…
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
Suggested Courses

770 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