By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,775 Members | 1,306 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,775 IT Pros & Developers. It's quick & easy.

simple question

P: n/a
Hello

sorry I don't know about javascript but I have to finish my work and
there I have some scripts

on my page I have a textarea form and a select form
when a user click in the select form I need the text of the selection
apears in my textare form
that's all

Could you give me the shortest way to do that?
Thank you to all of you.
<textarea rows="4" name="S1" cols="48"></textarea>

<select size="6" name="D1" id="fname" onchange="???">
<option>DELETE</option>
<option>INSERT</option>
<option>UPDATE</option>
</select>

Oct 16 '07 #1
Share this Question
Share on Google+
17 Replies


P: n/a
On Oct 16, 4:53 am, AlBen <caspio...@hotmail.comwrote:
Hello

sorry I don't know about javascript but I have to finish my work and
there I have some scripts
The person who should (and likely will) be sorry is the one who
assigned JavaScript-related work to someone who doesn't know about
JavaScript.
>
on my page I have a textarea form and a select form
Apparently you don't know about HTML either. Those are input
elements, not forms.
when a user click in the select form I need the text of the selection
apears in my textare form
that's all

Could you give me the shortest way to do that?
Thank you to all of you.

<textarea rows="4" name="S1" cols="48"></textarea>

<select size="6" name="D1" id="fname" onchange="???">
<option>DELETE</option>
<option>INSERT</option>
<option>UPDATE</option>
</select>
this.form.elements.S1.value = this.options[this.selectedIndex].text;

Oct 16 '07 #2

P: n/a
AlBen wrote:
on my page I have a textarea form and a select form
when a user click in the select form I need the text of the selection
apears in my textare form
A(n HTML) form *consists of* form _controls_ (not forms), which e.g.
`textarea' and `select' elements are.
that's all

Could you give me the shortest way to do that?
[...]
<form action="..." ...>
...

<textarea rows="4" name="S1" cols="48"></textarea>

<select size="6" ...
onclick="this.form.elements['S1'].value += this.value;">
<option>DELETE</option>
<option>INSERT</option>
<option>UPDATE</option>
</select>

...
</form>

RTFM. RTFFAQ. http://jibbering.com/faq/
PointedEars
--
Prototype.js was written by people who don't know javascript for people
who don't know javascript. People who don't know javascript are not
the best source of advice on designing systems that use javascript.
-- Richard Cornford, cljs, <f8*******************@news.demon.co.uk>
Oct 16 '07 #3

P: n/a
On Oct 16, 5:24 am, Thomas 'PointedEars' Lahn <PointedE...@web.de>
wrote:
AlBen wrote:
on my page I have a textarea form and a select form
when a user click in the select form I need the text of the selection
apears in my textare form

A(n HTML) form *consists of* form _controls_ (not forms), which e.g.
`textarea' and `select' elements are.
that's all
Could you give me the shortest way to do that?
[...]

<form action="..." ...>
...

<textarea rows="4" name="S1" cols="48"></textarea>

<select size="6" ...
onclick="this.form.elements['S1'].value += this.value;">
The change event would be more appropriate (and accessible.)

Oct 16 '07 #4

P: n/a
Thomas 'PointedEars' Lahn wrote:
<form action="..." ...>
...

<textarea rows="4" name="S1" cols="48"></textarea>

<select size="6" ...
onclick="this.form.elements['S1'].value += this.value;">
<option>DELETE</option>
<option>INSERT</option>
<option>UPDATE</option>
</select>
Individual options should preferably be approached by "selectedIndex"
rather than "value".

--
Bart

Oct 16 '07 #5

P: n/a
Thomas 'PointedEars' Lahn said the following on 10/16/2007 5:24 AM:

<snip>
<select size="6" ...
onclick="this.form.elements['S1'].value += this.value;">
<option>DELETE</option>
onchange="alert(this.value)" and test it in IE......

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Oct 16 '07 #6

P: n/a
Thomas 'PointedEars' Lahn wrote:
AlBen wrote:
>on my page I have a textarea form and a select form
when a user click in the select form I need the text of the selection
apears in my textare form
[...]
onclick="this.form.elements['S1'].value += this.value;">
This instruction doesn't make the text of the selected option appear
in the textarea. It just keeps the current value of the textarea, and
adds the text of the selected option at the end of it.

--
Bart

Oct 16 '07 #7

P: n/a
Thank you guys!

Only, I would like to ask David Mark about one thing.
The most important in our life is to Keep Our Feet On The GROUND!!!
What dou you think David?

Oct 16 '07 #8

P: n/a
Randy Webb wrote:
Thomas 'PointedEars' Lahn said the following on 10/16/2007 5:24 AM:
> <select size="6" ...
onclick="this.form.elements['S1'].value += this.value;">
<option>DELETE</option>

onchange="alert(this.value)" and test it in IE......
<form action="..." ...>
...

<textarea rows="4" name="S1" cols="48"></textarea>

<select size="6" ...
onclick="this.form.elements['S1'].value +=
this.options[this.selectedIndex].text + ' ';">
<option>DELETE</option>
<option>INSERT</option>
<option>UPDATE</option>
</select>

...
</form>

The trailing space is only appended here because this looks like an SQL
statement builder. Evaluating the text cursor position to make this a
statement editor is left as an exercise to the reader.
PointedEars
--
"Use any version of Microsoft Frontpage to create your site. (This won't
prevent people from viewing your source, but no one will want to steal it.)"
-- from <http://www.vortex-webdesign.com/help/hidesource.htm>
Oct 16 '07 #9

P: n/a
On Oct 16, 11:24 am, AlBen <caspio...@hotmail.comwrote:
Thank you guys!

Only, I would like to ask David Mark about one thing.
The most important in our life is to Keep Our Feet On The GROUND!!!
What dou you think David?
About what?

Oct 16 '07 #10

P: n/a
Thomas 'PointedEars' Lahn said the following on 10/16/2007 5:39 PM:
Randy Webb wrote:
>Thomas 'PointedEars' Lahn said the following on 10/16/2007 5:24 AM:
>> <select size="6" ...
onclick="this.form.elements['S1'].value += this.value;">
<option>DELETE</option>
onchange="alert(this.value)" and test it in IE......

<form action="..." ...>
...

<textarea rows="4" name="S1" cols="48"></textarea>

<select size="6" ...
onclick="this.form.elements['S1'].value +=
this.options[this.selectedIndex].text + ' ';">
<option>DELETE</option>
<option>INSERT</option>
<option>UPDATE</option>
</select>

...
</form>
Still a dumb way to do it. Simply give the OPTION a value and be done
with it....... Might even make it easier to get the *value* of the
select element on the server if/when the form is submitted.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Oct 17 '07 #11

P: n/a
Randy Webb wrote:
Thomas 'PointedEars' Lahn said the following on 10/16/2007 5:39 PM:
>Randy Webb wrote:
>>Thomas 'PointedEars' Lahn said the following on 10/16/2007 5:24 AM:
<select size="6" ...
onclick="this.form.elements['S1'].value += this.value;">
<option>DELETE</option>
onchange="alert(this.value)" and test it in IE......
<form action="..." ...>
...

<textarea rows="4" name="S1" cols="48"></textarea>

<select size="6" ...
onclick="this.form.elements['S1'].value +=
this.options[this.selectedIndex].text + ' ';">
<option>DELETE</option>
<option>INSERT</option>
<option>UPDATE</option>
</select>

...
</form>

Still a dumb way to do it.
IBTD.
Simply give the OPTION a value and be done with it....... Might even make
it easier to get the *value* of the select element on the server if/when
the form is submitted.
The reason I did not propose to use the `value' attribute here is that I am
quite certain that this form will never be submitted; at least the `select'
control would not need to (and so would not need a name, BTW). And then,
provided that the `value' property of the `select' would be as compatible as
it needs to be, the advantage of slightly faster property access with that
property would not outweigh the disadvantage of having to maintain attribute
value *and* element content per each option.
PointedEars
Oct 17 '07 #12

P: n/a

WOW men ! ))))
This is really a surprise that a "simple question" can generate a GOOD
discussion.
I'm a developer in win32 env. during the last 12 years and every time
surprised that a javascript can give so much headache for people who
develop with.

For David re-read you first comment and try to understand that I/WE
don't need such an answer in this forum. Sorry.

Oct 17 '07 #13

P: n/a
AlBen wrote:
WOW men ! ))))
This is really a surprise that a "simple question" can generate a GOOD
discussion.
I'm a developer in win32 env. during the last 12 years and every time
surprised that a javascript can give so much headache for people who
develop with.
Its cos its a crap language with the worst features of three or four
thrown together, probably by a computer scientist.
Makes you long for COBOL - a langauge designed so that any Navy Grunt
could more or less with attention to detail, write a program..

>
For David re-read you first comment and try to understand that I/WE
don't need such an answer in this forum. Sorry.
Oct 17 '07 #14

P: n/a
On Oct 17, 9:22 am, AlBen <caspio...@hotmail.comwrote:
WOW men ! ))))
This is really a surprise that a "simple question" can generate a GOOD
discussion.
I'm a developer in win32 env. during the last 12 years and every time
surprised that a javascript can give so much headache for people who
develop with.

For David re-read you first comment and try to understand that I/WE
don't need such an answer in this forum.
You mean the one where I answered your question? If you didn't want
an answer, then perhaps you shouldn't have posted a question.

And if you don't know script and/or HTML, perhaps you shouldn't be
scripting Web pages.

Oct 18 '07 #15

P: n/a
You mean the one where I answered your question? If you didn't want
an answer, then perhaps you shouldn't have posted a question.

And if you don't know script and/or HTML, perhaps you shouldn't be
scripting Web pages.
Occasionally In IT we all doing things in what we are not good.
Not true?

But I don't need at all that a ..... ...... like you remind me a thing
that is evident.
That's all.
Have a good day.

Oct 18 '07 #16

P: n/a
On Oct 18, 3:36 am, AlBen <caspio...@hotmail.comwrote:
You mean the one where I answered your question? If you didn't want
an answer, then perhaps you shouldn't have posted a question.
And if you don't know script and/or HTML, perhaps you shouldn't be
scripting Web pages.

Occasionally In IT we all doing things in what we are not good.
Not true?
Not in a well-managed IT department. Why would you assign a scripting
task to someone who lacks basic knowledge about scripting?

Oct 18 '07 #17

P: n/a

"The Natural Philosopher" <a@b.cwrote in message
news:11****************@demeter.uk.clara.net...
AlBen wrote:
>WOW men ! ))))
This is really a surprise that a "simple question" can generate a GOOD
discussion.
I'm a developer in win32 env. during the last 12 years and every time
surprised that a javascript can give so much headache for people who
develop with.

Its cos its a crap language with the worst features of three or four
thrown together, probably by a computer scientist.
Makes you long for COBOL - a langauge designed so that any Navy Grunt
could more or less with attention to detail, write a program..
Yeah, right.

http://home.swbell.net/mck9/cobol/style/alter.html
>
>>
For David re-read you first comment and try to understand that I/WE
don't need such an answer in this forum. Sorry.

Oct 19 '07 #18

This discussion thread is closed

Replies have been disabled for this discussion.