Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Loading Text into a TEXTAREA

Posted on 1998-08-17
8
Medium Priority
?
227 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

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.
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …

618 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