473,395 Members | 1,680 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,395 software developers and data experts.

Get menu list label

Hi
I'm sure this is a rather basic question but I can't figure it out
I have a menu list as follows

<select name="par" onchange="alert(this.value)">
<option value="1"><"A"</option>
<option value="2"><"B"</option>
<option value="3"><"C"</option>
</select>

When I make a selection I can get the id using this.value, how do I get
the lable ie the A,B orC

Sep 23 '06 #1
2 1827
ASM
Steven a écrit :
Hi
I'm sure this is a rather basic question but I can't figure it out
I have a menu list as follows

<select name="par" onchange="alert(this.value)">
<option value="1"><"A"</option>
<option value="2"><"B"</option>
<select name="par" onchange="alert(this.value+'\n'+this.text)">
<option value="1">"A"</option>
<option value="2">"B"</option>
<option value="3"><"C"</option>
</select>

When I make a selection I can get the id using this.value, how do I get
the lable ie the A,B orC
document.forms['myForm'].par[document.forms['myForm'].par.selectIndex].text;

brieffly and if in same form

selectedLabel = par.text;
selectedValue = par.value;
--
ASM
Sep 23 '06 #2
ASM
ASM a écrit :
>
document.forms['myForm'].par[document.forms['myForm'].par.selectIndex].text;
document.forms['myForm'].par[document.forms['myForm'].par.selectedIndex].text;

..
Sep 23 '06 #3

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

Similar topics

1
by: Michael Champagne | last post by:
Does anyone have any examples or links to examples of generating a simple unordered list menu with multiple levels from an XML file? We are redesigning the navigation on our website and I was...
1
by: Josh | last post by:
Caution, newbie approaching... I'm trying to come up with a very simple Tkinter test application that consists of a window with a drop-down menu bar at the top and a grid of colored rectangles...
3
by: Adonis | last post by:
I wish to create a popup menu from a list, when it is created they all show the same label from the list: Months = def _Menu_Click(self, month): print month menu = Menu(fraMain, tearoff=0)
2
by: Jackson Yap | last post by:
can someone kind enough to help me look at the attached html and js file? Why is it that the javascript menu could not work at www.apchosting.net but could work at...
2
by: Anthony | last post by:
Hi all, i have managed to create an asp.net menu using xml and xslt.. i am now trying to highlite the selected path by sending in the path info and hilite it using an xsl select choose function....
3
by: John | last post by:
Hi there, I was reading an article (http://avenuea-razorfish.com/articles/TheAll-MenuNavigation_Turbek.pdf) on 'all-menu navigation' and I'd like to try and implement this in my site. Can...
1
by: bruce628 | last post by:
I want to use SWT Label and popmenu to construct a menubar ,and the effect of this menubar is same to the menubar in SWT.When click the Label,it should be highlighted and popmenu shows.The issue is...
2
by: Ravi Joshi | last post by:
The menu on my site works fine in IE6 and Firefox. In IE7, there is a problem with the menu: when you mouse over the various main catagories, the sub-catagories all appear to the right as they...
0
by: mjohnson0321 | last post by:
I am trying to incorporate a CSS drop-down menu into a site (suckerfish menu). The menu gets lost behind the content below it, but only on one of the drop downs (News). The error occurs on all of...
7
by: TechnoAtif | last post by:
Hi..There is again a similar problem..Now i;ve got the option values of list?menu box to show the textbox. If the option value of list is yes then the textbox is to be displayed . Can anyone...
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: 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...
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...
0
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,...
0
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...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.