473,835 Members | 1,832 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Why does textarea.value= not work

I have never had a textarea content change, in any browser.
On several different projects.
With javascript enabled (other stuff works.)
I have read lots, and everyone says it should work.
Can anyone tell my what's wrong with the following code?
(I was trying to create a simple demo example.
The alerts are there just to help find out where it fails.
The onClick isn't even getting executed, even though
I get it to work elsewhere.)
------ textarea.htm ---------
<html>
<head>
<script type="text/javascript">
<--
function fillit(obj) {
alert('fillit called');
var x = obj.form.bigbox ;
alert('The big box had: ' + x.value);
x.value = 'Some new text';
alert('The big box should have some new text in it.');
return false;
}
//-->
</script>
</head>
<body>
<form id="myform" name="myform" action="textare a.htm" method="post">
<textarea id="bigbox" name="bigbox" rows="5" cols="25">Origi nal
text</textarea>
<input type="submit" id="doit" name="doit" value="Change the text"
onClick="return fillit(this);">
</form>
</body>
</html>
Mar 23 '08 #1
8 2539
Lee
Sandy Tipper said:
>
I have never had a textarea content change, in any browser.
On several different projects.
With javascript enabled (other stuff works.)
I have read lots, and everyone says it should work.
Can anyone tell my what's wrong with the following code?
(I was trying to create a simple demo example.
The alerts are there just to help find out where it fails.
The onClick isn't even getting executed, even though
I get it to work elsewhere.)
------ textarea.htm ---------
<html>
<head>
<script type="text/javascript">
<--
function fillit(obj) {
alert('fillit called');
var x = obj.form.bigbox ;
alert('The big box had: ' + x.value);
x.value = 'Some new text';
alert('The big box should have some new text in it.');
return false;
}
//-->
</script>
</head>
<body>
<form id="myform" name="myform" action="textare a.htm" method="post">
<textarea id="bigbox" name="bigbox" rows="5" cols="25">Origi nal
text</textarea>
<input type="submit" id="doit" name="doit" value="Change the text"
onClick="retur n fillit(this);">
</form>
</body>
</html>
Don't use in input of type "submit" unless you're submitting
the form, and don't use SGML comments around script:

<html>
<head>
<script type="text/javascript">
function fillit(obj) {
alert('fillit called');
var x = obj.form.bigbox ;
alert('The big box had: ' + x.value);
x.value = 'Some new text';
alert('The big box should have some new text in it.');
return false;
}
</script>
</head>
<body>
<form id="myform" name="myform" action="textare a.htm" method="post">
<textarea id="bigbox" name="bigbox" rows="5" cols="25">Origi nal
text</textarea>
<input type="button" id="doit" name="doit" value="Change the text"
onClick="return fillit(this);">
</form>
</body>
</html>
--

Mar 23 '08 #2
Sandy Tipper wrote:
<script type="text/javascript">
<--
^^^
There is a syntax error; `<' and `--' are operators. If you had avoided the
nonsensical attempt of pseudo-commenting out `script' element content with
`<!-- ... //-->' in the first place, you would not have fallen victim to
this error. That said, simple debugging would have revealed it:

http://jibbering.com/faq/

Markup validation will reveal more problems with your code:

http://validator.w3.org/
PointedEars
--
var bugRiddenCrashP ronePieceOfJunk = (
navigator.userA gent.indexOf('M SIE 5') != -1
&& navigator.userA gent.indexOf('M ac') != -1
) // Plone, register_functi on.js:16
Mar 23 '08 #3
"Thomas 'PointedEars' Lahn" <Po*********@we b.dewrote in message
news:47******** ******@PointedE ars.de...
Sandy Tipper wrote:
><script type="text/javascript">
<--
^^^
There is a syntax error; `<' and `--' are operators. If you had avoided
the
nonsensical attempt of pseudo-commenting out `script' element content with
`<!-- ... //-->' in the first place, you would not have fallen victim to
this error. That said, simple debugging would have revealed it:
http://jibbering.com/faq/
Markup validation will reveal more problems with your code:
http://validator.w3.org/

PointedEars
--
var bugRiddenCrashP ronePieceOfJunk = (
navigator.userA gent.indexOf('M SIE 5') != -1
&& navigator.userA gent.indexOf('M ac') != -1
) // Plone, register_functi on.js:16
No need to be sarcastic. Especially when you're on thin ice.
The comments vare recommended practice to prevent misunderstandin g
by old browsers who don't recognoze the <scripttag. See:
http://www.w3schools.com/html/html_scripts.asp
HJowever, I know there are problems with the code,
that;s why I asked for help.
My debugger doidn't see anthing wrong.with the generated
html page, but I didn't know to use the java cnsole.
So now I know something is wrong, but don't know what.
(I used a "button" instead of "submit", not difference.
Mar 24 '08 #4
Sandy Tipper wrote:
I have never had a textarea content change, in any browser.
On several different projects.
With javascript enabled (other stuff works.)
I have read lots, and everyone says it should work.
Can anyone tell my what's wrong with the following code?
(I was trying to create a simple demo example.
The alerts are there just to help find out where it fails.
The onClick isn't even getting executed, even though
I get it to work elsewhere.)
------ textarea.htm ---------
<html>
<head>
<script type="text/javascript">
<--
function fillit(obj) {
alert('fillit called');
var x = obj.form.bigbox ;
alert('The big box had: ' + x.value);
x.value = 'Some new text';
alert('The big box should have some new text in it.');
return false;
}
//-->
</script>
</head>
<body>
<form id="myform" name="myform" action="textare a.htm" method="post">
<textarea id="bigbox" name="bigbox" rows="5" cols="25">Origi nal
text</textarea>
<input type="submit" id="doit" name="doit" value="Change the text"
onClick="return fillit(this);">
</form>
</body>
</html>
I believe (but am not 100% positive) that you need textarea.innerH TML
Mar 24 '08 #5
Thomas 'PointedEars' Lahn <Po*********@we b.dewrites:
[...] they should refrain from using W3School as Web development
reference, which has been proven wrong or misleading so often
does anybody care reposting some good, up-to-date tutorial reference
for yet another newcomer?

thank you in advance,
g
--
E ti esorto a prendere in considerazione entrambe le fonti perché il
mio parere è che, molto spesso, prendere solo quelle che facciano
riferimento ad una parte in gioco, non aiuti ad avere un quadro
obiettivo della situazione. -- LDA, in ISC
Jun 27 '08 #6
Giacomo Boffi wrote:
Thomas 'PointedEars' Lahn <Po*********@we b.dewrites:
>[...] they should refrain from using W3School as Web development
reference, which has been proven wrong or misleading so often

does anybody care reposting some good, up-to-date tutorial reference
for yet another newcomer?
Because Web development is a wide field, that would depend on the subject
you are exactly interested in. For example, in this almost two months old
subthread you have posted a followup in, the subject was whether it was
necessary and a Good Thing to pseudo-comment out `script' element content.

Therefore, I suggest you subscribe to this newsgroup and the newsgroups in
the comp.infosystem s.www.authoring.* hierarchy, and check for new postings
regularly as the discussions in the technical Usenet newsgroups are without
doubt the most up-to-date and most factually correct tutorial you can get on
Web development (if anyone posts nonsense, it it very likely that someone
else will correct it and so on). It is not necessarily easy to understand
for a newcomer, but I think you will adapt and learn like we all still do.
thank you in advance,
You are welcome.
PointedEars
--
var bugRiddenCrashP ronePieceOfJunk = (
navigator.userA gent.indexOf('M SIE 5') != -1
&& navigator.userA gent.indexOf('M ac') != -1
) // Plone, register_functi on.js:16
Jun 27 '08 #7
Thomas 'PointedEars' Lahn <Po*********@we b.dewrites:
Giacomo Boffi wrote:
>Thomas 'PointedEars' Lahn <Po*********@we b.dewrites:
>>[...] they should refrain from using W3School as Web development
reference, which has been proven wrong or misleading so often

does anybody care reposting some good, up-to-date tutorial
reference for yet another newcomer?

Because Web development is a wide field, that would depend on the
subject you are exactly interested in. For example, in this almost
two months old subthread you have posted a followup in, the subject
was whether it was necessary and a Good Thing to pseudo-comment out
`script' element content.

Therefore, I suggest you subscribe to this newsgroup and the
newsgroups in the comp.infosystem s.www.authoring.* hierarchy, and
check for new postings regularly as the discussions in the technical
Usenet newsgroups are without doubt the most up-to-date and most
factually correct tutorial you can get on Web development (if anyone
posts nonsense, it it very likely that someone else will correct it
and so on). It is not necessarily easy to understand for a
newcomer, but I think you will adapt and learn like we all still do.
thank you Thomas, yours is an ambitious, well conceived grand plan,
but it's oversized with respect to my modest request of a reference to
an up to date tutorial for javascript (site or book), taking into
account that i'm only a curious man, not a future web developer

en passant, i must remark that c.l.javascript' s faq mentions just
only one tutorial, w3school's one...

again, thank you
g
--
"It will be rain tonight."
"Let it come down."
Jun 27 '08 #8
On Thu, 22 May 2008 21:19:35 +0200, Giacomo Boffi wrote:
en passant, i must remark that c.l.javascript' s faq mentions just
only one tutorial, w3school's one...
http://www.google.com/search?hl=en&q...pt+tutorial%22
turns up "about 237,000" hits.

Good Luck!
Rich

Jun 27 '08 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
5279
by: Simon | last post by:
I have another question.. Let's take a textarea with the parameter: "rows=4" (<textarea rows=4 onkeydown="CheckScrollbar()"> ) If you start typing the scrollbar at the right is not active. Only when you exceed the four lines (rows=4) the scrollbar becomes active. That moment..the moment the scrollbar becomes active..can javascript recognize/capture this moment? Thanks, Simon
4
3611
by: Brian Glen Palicia | last post by:
My goal is to accept input from the user into a text box and then parse the data using split(). The first step is this tiny program to test the split() function. It runs in IE, but in Mozilla it just hangs and keeps loading forever. I checked around on the web and in USENET, but I haven't seen any mention of split() not working in Mozilla. Thoughts? Thanks in advance. <HTML> <HEAD> </HEAD>
5
3028
by: lawrence | last post by:
How to add text to a textarea using javascript? Apparently this is a popular question, because when I run the search on google, there are a lot of returns: http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&q=how+to+add+text+to+a+textarea&btnG=Search&meta=group%3Dcomp.lang.javascript However, all of the examples seem case specific, rather than generic. I'm new to Javascript, so it is not so easy for me to take a specific example and...
6
8099
by: lkrubner | last post by:
I'm offering users the ability to type weblog posts into a form and post them. They type the text into a TEXTAREA which is on a form. The form, when submitted, hits a PHP script. Before it is submitted, while they are typing, I'm trying to offer them some common word processing functions. I want to implement unlimited undo and redo for the textarea. I've set the textarea to onChange="addToArrayOfPastWork()"; My undo button gives me...
5
12163
by: Jesper Rønn-Jensen | last post by:
I have a textarea that must be limited to 70 characters. No big deal -- at least so I thought. * Textarea must not exceed 70 characters * Exceeding content must be cut off * Must work on input by keyboard (keypress, keyup events) * Must work on pasted input from context menu * Must work on pasted input via CTRL+V and similar * Must work on pasted input via browsers menu>Edit>Paste * Must work in Mozilla + IE and coded via W3C standards
8
8453
by: McKirahan | last post by:
Firefox does not reflect selected option via innerHTML How do I get Firefox to reflect selected option values? <html> <head> <title>FFinner.htm</title> <script type="text/javascript"> function clicks() { document.getElementById("t1").value =
16
2858
by: Jen | last post by:
Hi. I have this problem that I think should be easy but have been struggling with this for days. I have a list based on a recordset from a database. This list consists of records meeting a certain criteria and at the bottom of this list i have a button that inserts all these records to a´nother table in the database. So long everything's ok. BUT, at the top of this list I have a textarea that the user can write down some text to be put...
23
3843
by: Angus | last post by:
Hello I have a DIV with various elements eg: <div ARID="8" ARType="Char" ARDBN="Short Description"> <label class="label f9" for="arid8"Short Description</label> <textarea class="text sr " wrap="off" id="arid8" rows=1></textarea> </div> I have a variable, divs, which contains the DIV's and divs contains
7
4231
by: Totti | last post by:
Hi all, I am a newbie to javascript learning it for 2 months now, i am trying to make a sorter who will read english words from the one tex area or data file and show the result in the 2nd text area, in other words, howerever the words are set, horizontally the one following the other or vertically, the one under the other. i want it to work, i tried some code but i am having problems it only work when the text entered is horizontal like...
0
9808
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9652
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10812
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10235
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7766
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5638
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5804
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3995
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3089
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.