473,383 Members | 1,896 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

simple question

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
17 2401
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
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
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
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
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
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
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
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
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
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
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

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

"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Patchwork | last post by:
Hi Everyone, Please take a look at the following (simple and fun) program: //////////////////////////////////////////////////////////////////////////// ///////////// // Monster Munch, example...
1
by: Proteus | last post by:
Any help appreciated on a small perl project I need to write for educator/teaching purposes. I have not programmed perl for some time, need to get up to speed, maybe some kind souls hrere will help...
2
by: Raskolnikow | last post by:
Hi! I have a very simple problem with itoa() or the localtime(...). Sorry, if it is too simple, I don't have a proper example. Please have a look at the comments. struct tm *systime; time_t...
3
by: Peter | last post by:
Hello Thanks for reviewing my question. I would like to know how can I programmatically select a node Thanks in Advanc Peter
7
by: abcd | last post by:
I am trying to set up client machine and investigatging which .net components are missing to run aspx page. I have a simple aspx page which just has "hello world" printed.... When I request...
4
by: dba_222 | last post by:
Dear Experts, Ok, I hate to ask such a seemingly dumb question, but I've already spent far too much time on this. More that I would care to admit. In Sql server, how do I simply change a...
14
by: Giancarlo Berenz | last post by:
Hi: Recently i write this code: class Simple { private: int value; public: int GiveMeARandom(void);
30
by: galiorenye | last post by:
Hi, Given this code: A** ppA = new A*; A *pA = NULL; for(int i = 0; i < 10; ++i) { pA = ppA; //do something with pA
10
by: Phillip Taylor | last post by:
Hi guys, I'm looking to develop a simple web service in VB.NET but I'm having some trivial issues. In Visual Studio I create a web services project and change the asmx.vb file to this: Imports...
17
by: Chris M. Thomasson | last post by:
I use the following technique in all of my C++ projects; here is the example code with error checking omitted for brevity: _________________________________________________________________ /*...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.