HTML select auto drops down but losses highlight

  • Thread starter Thread starter John
  • Start date Start date
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
 
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)
 
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
 
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
 
Back
Top