473,326 Members | 2,337 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,326 software developers and data experts.

Selecting items in a list/menu with javascript

How can I use javascript to select Items in a List/Menu? For example:
(value1, value2) will select value1 and value2 in a list menu....

Nov 23 '05 #1
4 1582
> How can I use javascript to select Items in a List/Menu? For example:
(value1, value2) will select value1 and value2 in a list menu....


Can you clarify and include some sample code? We may be able to help if
we could better understand the problem.

Nov 23 '05 #2

OK.. I'll do my best to clarify. A user does a search and pulls up a
list of clients. I have a form on the side of the list that they can
use to add a new client if its not in the list. If the client is in the
list, they can click on the client's name and it will poplulate that
form with all of their information so they can update the record. One
of the fields is a List/Menu box that allow for multiple selections. So,
I am passing, for example onclick=popform('Show, Sold') which are two
elements in that menu box. I need to have both of those selected when I
do the onclick event. Is that possible?

Does that help?
*** Sent via Developersdex http://www.developersdex.com ***
Nov 23 '05 #3
If I am understanding right, you are trying to populate a couple of
text fields from the selection in a <select> tag selection?

<option value="textfield1|textfield2" onclick="popform(this)">some
option</option>

function popform(el) {
fields = el.value.split('|');
this.form.textfield1.value = fields[0];
this.form.textfield2.value = fields[1];
}

Is this something like what you were hoping for?

Nov 23 '05 #4
Never mind, I just figured out what you want.

el = document.formName.selectName;
opts = el.options;
for (i=0;i<opts.length;i++) {
if (opts[i].selected) {
// do something with this option
}
}

Nov 23 '05 #5

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

Similar topics

5
by: R.G. Vervoort | last post by:
Not sure if it is a php question but since i am working in php here it is. Ho can i add items to (the item label=visual text and the value=index number) a list object on a website. I am having...
1
by: michael | last post by:
Below dropmenu and javascript modifies ul properties depending on if a link within matches the current url. If a match is found the .high style applies to the relevant section, or .low if no...
5
by: Mark | last post by:
Hi - is it possible to pass a comma delimeted list to a javascript function, which will then loop through the list, and check against a listboxs items, and if the value in the list, corresponds to...
3
by: Gumtree | last post by:
Hi folks, The user interface I'm trying to impliment looks a bit like this: Not Chosen Chosen .------------. .------------. |Item 1 | -> |Item 3 | |Item 2 | <-...
1
by: newcomer | last post by:
I have a javascript index that is similar to the one in the Windows help. It has a text field that allows the you to type text and it finds the closest item in the list below the text field. The...
3
by: james.dixon | last post by:
Hi I was wondering if anyone else had had this problem before (can't find anything on the web about it). I have three select elements (list boxes - from here on I'll refer to them as 'the...
2
by: DFS | last post by:
I inadvertently deleted all the items from the built-in Access97 Window menu: Tile Horizontally, Tile Vertically, Cascade, etc. Can I somehow get them back without reinstalling Access97 (or...
13
by: PetterL | last post by:
I writing a program where I read menu items from a file. But I have problem when I click an menu item i want it to mark that one as checked but I cant access the menu object of that item to see...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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...

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.