Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

troubles with an "onfocus" in a <select>

Status
Not open for further replies.

JulianUK

Programmer
Joined
Apr 17, 2002
Messages
73
Location
GB
Hi
A niggling problem
I want my select box to change colour when it receives focus. So...

onfocus="this.style.background='#4F58FF';" onblur="this.style.background='#4F588F'"

Dark blue, to light blue, and back.

Trouble is, only the current <option> gets the colour change, the dropped down items remain in the same colour. If the drop down is closed then opened again, the colours appear higlighted as i want.

Its as if the onfocus isn't 'firing' before the drop down list is drawn.

Can I get round this?

Many thanks

Julian
 
no ideas anyone? pleeeease?!
 
Could you loop through the options and change all their background colors?
 
Also try this

el.style.backgroundColor
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top