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

Forcing drop-down list to appear

ehm
I apologize in advance for the cross-post (from
microsoft.public.inetexplorer.scripting), but that board seems dead.

I have what I think is a fairly simple problem, but I cannot figure
this out. I have a SELECT object on my page. When the user performs
a certain action, I want the focus to be placed in the drop-down field
AND the actual list of drop-down objects to appear (i.e. simulating
that the user has clicked in that field). Ideally, of course, the
currently selected entry should be highlighted. Listed below is a
snippet of sample code. If the focus is currently in the text field
and the user clicks on the "Test" button, I would like the entire
drop-down menu to appear. I have not had any success with the
"fireEvent" method or the "click" method (only "focus" seems to work).

Any help would be greatly appreciated. Thanks in advance.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<BODY>

<SCRIPT LANGUAGE="Javascript1.2">

function displayDropDown() {
fooObj = eval("document.Form.FooComboBox");
fooObj.focus();
fooObj.click();
//fooObj.fireEvent("onfocus");
//fooObj.fireEvent("onclick");
} //displayDropDown

</SCRIPT>

<FORM method="POST" Name="Form" AUTOCOMPLETE="OFF">
<TABLE>
<TR>
<TD>
<SELECT name="FooComboBox">
<OPTION VALUE="foo1" SELECTED>foo1</OPTION>
<OPTION VALUE="foo2">foo2</OPTION>
<OPTION VALUE="foo3">foo3</OPTION>
</TD>
</TR>

<TR>
<TD>
<INPUT type="test" name="FooTextField" value="">
</TD>
</TR>

<TR>
<TD>
<INPUT type="Button" name="FooButton" value="Test" ENABLED
onClick="displayDropDown()">
</TD>
</TR>
</FORM>
</BODY>
</HTML>
Jul 20 '05 #1
1 3953
ehm wrote:
I apologize in advance for the cross-post (from
microsoft.public.inetexplorer.scripting), but that board seems dead.

I have what I think is a fairly simple problem, but I cannot figure
this out. I have a SELECT object on my page. When the user performs
a certain action, I want the focus to be placed in the drop-down field
AND the actual list of drop-down objects to appear (i.e. simulating
that the user has clicked in that field).


You can't programmatically make a <select> open.

--
| Grant Wagner <gw*****@agricoreunited.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

0
by: Hugh Lutley | last post by:
I'm trying to install the Device::SerialPort module using CPAN but whilst CPAN is running 'make test' a couple of errors are flagging so I cannot continue the install without forcing it. I'm not...
12
by: Ritz, Bruno | last post by:
hi in java i found that when a method has a throws clause in the definition, callers must either handle the exceptions thrown by the method they are calling or "forward" the exception to the...
2
by: petev | last post by:
Hello, can anyone help me out?? Maybe its a bit complicated, maybe not :) I'll try to explain. Am not a programmer so have patience! I have a website whose url looks like this:...
40
by: Neo The One | last post by:
I think C# is forcing us to write more code by enforcing a rule that can be summarized as 'A local variable must be assgined *explicitly* before reading its value.' If you are interested in what...
21
by: CoffeeGood | last post by:
Hi folks, I have a 64-bit machine and on this machine I want to run an old program that was written to assume that longs are 32 bits. I've discovered however that gcc on this machine...
1
by: Hal Vaughan | last post by:
I am not a C programmer. I've read a bit here and there and produced a "Hello, World" program or two, but I've never gotten into what actually happens with the ./configure && make && make install...
3
by: cocco | last post by:
I'm trying to have several <hr>, all on the same line, even if this can seem a nonsense, with the shortest code. So, I do not want to use abolute positioning and virtual div. Is it possible to...
4
by: ATS16805 | last post by:
Hi. I wonder if it's possible to "force" a browser to "switch to SSR mode" for any given document. Specifically, I'm looking for a solution, not to a User Agent issue (i think), but a coding idea;...
8
by: Ted Zlatanov | last post by:
Hello, my problem is very simple. I have: <div id="enclosing"> <div id="d1"> <span id="s1">S1</span> <span id="s2">S2</span> <span id="s3">S3</span> </div>
7
by: MLH | last post by:
If I drop Like "*ABC*" in a QBE grid criteria cell, the records returned include mixed case. Can I force the uppercase limitation in a QBE grid?
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.