Open SELECT list with script

A seemingly simple problem... I want to open a SELECT list drop down from an event like onClick from another object.

Is there anyway to open a <SELECT> list to show its drop down list using script? .focus() only, well... focuses and .click() only resets the selected value but does not open the drop down list.

I even tried a createEvent passing a focus, altKey and keyCode 40 (arrow down) to the document to simulate keyboard events that normally open a drop down list. This had no effect even though displaying the events showed they were in fact passed to the document.

Here's the code I'm using to try and pass keyboard events to the document from an onClick() event:

function openSelect(objSelect){
var evtObj;
var fired;

evtObj = document.createEventObject();
evtObj.focused= objSelect.focus(); //focus SELECT
evtObj.doc=document; // reference document in Event object
evtObj.doc.altKey = true; // create press Alt key
evtObj.doc.keyCode = 40; //create press Arrow down
//Execute event
fired = document.fireEvent("onkeydown",evtObj)

if(fired){
alert('fired');
}else{
alert('dead');
}

evtObj.cancelBubble = false;

}

[1229 byte] By [tatero] at [2008-2-7]
# 1

Wow. No replies. This is really that bad? What a bummer.

tatero at 2007-9-9 > top of Msdn Tech,.NET Development,JScript for the .NET Framework...
# 2
Just to inform you, there is no way to do it.

Eric

Pascarello at 2007-9-9 > top of Msdn Tech,.NET Development,JScript for the .NET Framework...

.NET Development

Site Classified