473,769 Members | 2,003 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Detecting when the select element's dropdown list is open and/or closed

I need to know when the select element's dropdown list is opened (as
when the user clicks on the arrow or does ALT-downarrow from the
keyboard). Similarly, I need to known when the dropdown list closes.

The closing of the dropdown list can happen without changing the
dropdown, hence the onchange event is not a sure way to determine that
the dropdown list closed.

Is this possible in Internet Explorer?

Thanks,
Rod
Jul 20 '05 #1
1 10153
Rod Early wrote:
I need to know when the select element's dropdown list is opened (as
when the user clicks on the arrow or does ALT-downarrow from the
keyboard). Similarly, I need to known when the dropdown list closes.

The closing of the dropdown list can happen without changing the
dropdown, hence the onchange event is not a sure way to determine that
the dropdown list closed.

Is this possible in Internet Explorer?

Thanks,
Rod


You only think you need to know when the drop-down list closes.

The drop-down list closes when some other element on the page receives
focus. So, trap focus on the item that the user is going to click after
selecting something from the drop-down menu:

<select name="mySelect" >
<option value="1">One</option>
<!-- etc -->
</select>
<input type="button" name="myButton"
onclick="alert( 'The drop-down menu has closed, the value is ' +
this.form.mySel ect.options[this.form.mySel ect.selectedInd ex].value);"
/>

--
| Grant Wagner <gw*****@agrico reunited.com>

* Client-side Javascript and Netscape 4 DOM Reference available at:
*
http://devedge.netscape.com/library/...ce/frames.html

* Internet Explorer DOM Reference available at:
*
http://msdn.microsoft.com/workshop/a...ence_entry.asp

* Netscape 6/7 DOM Reference available at:
* http://www.mozilla.org/docs/dom/domref/
* Tips for upgrading JavaScript for Netscape 7 / Mozilla
* http://www.mozilla.org/docs/web-deve...upgrade_2.html
Jul 20 '05 #2

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

Similar topics

1
7622
by: Tim Gosselin | last post by:
I am writing a tcp tunnel but cannot find a way of detecting when a socket shuts down its read end without writing to the socket. For testing the write end of the remote endpoint I just do a: if not sock.recv(buffsize) I cannot write to the socket and check if send returns 0 though, because that involves sending data out of the which may not have come in yet. When I try polling the socket with:
0
4071
by: Francis Parsons | last post by:
Hi! I'm doubtful there's a workaround for this problem, but it's worth a shot. I'm using IE's (css) "zoom" property to zoom the body of a document (in conjunction with persistance so the previously selected percentage level is restored each time the page is reloaded). I don't expect zoomed images to look perfect, but overall the quality of the zooming is pretty good (as good as Opera's ;-) EXCEPT for any <select> elements, which are...
9
11854
by: Prowler | last post by:
In our current application we have a page whose sole purpose for existence is to permit the user to select from a list (subsequent to our login page). We would like to have the list drop down automatically when the visitor arrives at the page, perhaps by using the onLoad event to call the dropdown code. The problem is, the click() event does not drop down the list, as I would have thought it might. I can successfully fire other methods...
1
1486
by: Andy Fish | last post by:
Hi, Part of my web form allows the user to select their favourite color (well it doesn't but it's a good example). There is a dropdown box with red, green, blue, and custom. When they click custom, a pop-up window allows them to select from other colors. This is done by an onclick event on the <select> element. So far so good. But what if they have selected a custom color and then want to change it?.
2
3253
by: hypomite | last post by:
I have an handler for the SelectedIndexChanged event of a dropdown box. I have also set the AutoPostBack option to True. When you select any item besides the first one, the event sucessfully fires. However, if you ever (even after you have selected other options previously) select the first option in the dropdown, the AutoPostBack fires(the page reloads), but the event does not. This is the only element on my page and ViewState is enabled...
13
2371
by: Oliver Hauger | last post by:
Hello, In my html form I show a select-element and if this element is clicked I fill it per JavaScript/DOM with option-elements. I use the following code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head>
4
2147
by: PM ArunKumar | last post by:
i have two dropdown list in my form where the values in the list of second drop down changes based on the value i select in the first dropdown.(very similar to country and states list), here after submitting the form, if i go back the value which i selected in my second dropdown list doesn't appear. for eg: if select USA and virginia ,when i go back USA appears but virginia doesn't appear in my page. can any help me to retain the value....
0
7348
acoder
by: acoder | last post by:
Problem The select object's add method doesn't append options to the end of the list. Browser Internet Explorer Example The Javascript code for appending an option element at the end of a select dropdown list: var opt = document.createElement("option"); opt.name = "optName";
1
3084
omerbutt
by: omerbutt | last post by:
hi i am making a intranet online test application for a school and for that i have to make a form for creating the test the logic is to select a subject and then the number of questions for that test initially there are only 2 select elements in the form namely the , subjects and the totalQuestions when it selects the choice in the totalQuestions dropdown it calls an onchange function makeAnswere(choice,rowId) which checks if the choice is, ...
0
9589
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
10211
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
10045
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9994
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8872
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7409
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
6673
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5447
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3959
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.