HTML select auto drops down but losses highlight

J

John

I'm rendering a Html Select to auto dropdown when created, it works but
losses it's normal mouseover effect of highlighting each row and the type a
letter to move to a macthing row functions.
If I try to type or click it to give it focus again it just fires the
changed event.
Any Ideas as to how I can modify this to function properly?

var formFld = document.createElement('select')
formFld.setAttribute('size', '15')
formFld.setAttribute('id', Drop)
formFld.style.position= 'absolute'
formFld.style.marginTop= '-10px'
formFld.name = Drop
formFld.style.width=300

var ce = document.getElementById(cel)
ce.appendChild(formFld)
formFld.focus()

Thanks John
 
B

bruce barker

you are setting the focus before the control is fully created and
displayed. try:

ce.appendChild(formFld);
window.setTimeout(function(){formFld.focus();});


-- bruce (sqlwork.com)
 
J

John

Thanks for your reply,
I applied your method but it is still the same result, instead of a
highlight I get a just a dotted border around the first row and no response
on mouseover to other rows. Thanks for your input though I gave it a 2
second delay, which was long enough for me to see the focus to be appiled.

John
 
J

John

I changed my event to onclick instead of onchange and added this to your
method and it is working, thanks again.

window.setTimeout(function(){formFld.focus(), formFld.selectedIndex = 0;});

John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,997
Messages
2,570,241
Members
46,831
Latest member
RusselWill

Latest Threads

Top