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