Jesper Posted March 29, 2009 Share Posted March 29, 2009 Hi everyone, This question has been asked many times, but after searching for more than an hour, I have not found a definitive answer to it: (How) Is it possible to change the select color on the options in a <select> menu from the system-blue to something else? Thanks in advance, Jesper Quote Link to comment https://forums.phpfreaks.com/topic/151641-change-select-color-of-option-elements/ Share on other sites More sharing options...
darkfreaks Posted March 29, 2009 Share Posted March 29, 2009 change it how in javascript or in CSS , you have given a vague situation which could cover a different number of ways to do so. ??? Quote Link to comment https://forums.phpfreaks.com/topic/151641-change-select-color-of-option-elements/#findComment-796382 Share on other sites More sharing options...
Jesper Posted March 30, 2009 Author Share Posted March 30, 2009 Either way is not really a problem, as JavaScript is required to be enabled by users anyways for this application. Quote Link to comment https://forums.phpfreaks.com/topic/151641-change-select-color-of-option-elements/#findComment-796797 Share on other sites More sharing options...
RichardRotterdam Posted March 30, 2009 Share Posted March 30, 2009 When(on which action) do you wish to change the color of the select? Quote Link to comment https://forums.phpfreaks.com/topic/151641-change-select-color-of-option-elements/#findComment-796817 Share on other sites More sharing options...
lonewolf217 Posted March 30, 2009 Share Posted March 30, 2009 <style type="text/css"> select { color:red; } </style> this will change the text of a SELECT dropdown to red. change it to whatever you want Quote Link to comment https://forums.phpfreaks.com/topic/151641-change-select-color-of-option-elements/#findComment-796863 Share on other sites More sharing options...
Jesper Posted March 31, 2009 Author Share Posted March 31, 2009 @ Dj Kat I don't really care on which event it takes place, I just want to replace the system-blue when hovering over an option to be another color. @ lonewolf217 As I described in my first post, I want to change the system-blue hovering color when you hover over an option . Quote Link to comment https://forums.phpfreaks.com/topic/151641-change-select-color-of-option-elements/#findComment-797568 Share on other sites More sharing options...
RichardRotterdam Posted March 31, 2009 Share Posted March 31, 2009 @ Dj Kat I don't really care on which event it takes place, I just want to replace the system-blue when hovering over an option to be another color. In this line you contradict yourself. You state you dont care on which event the color changing takes place. And then you say you want the color changing to take place on a hover event. Quote Link to comment https://forums.phpfreaks.com/topic/151641-change-select-color-of-option-elements/#findComment-797624 Share on other sites More sharing options...
lonewolf217 Posted March 31, 2009 Share Posted March 31, 2009 @ lonewolf217 As I described in my first post, I want to change the system-blue hovering color when you hover over an option . no, you didn't say anything about hovering (How) Is it possible to change the select color on the options in a <select> menu from the system-blue to something else? try this out http://www.webdeveloper.com/forum/showthread.php?t=184033 Quote Link to comment https://forums.phpfreaks.com/topic/151641-change-select-color-of-option-elements/#findComment-797667 Share on other sites More sharing options...
Jesper Posted April 1, 2009 Author Share Posted April 1, 2009 @ Dj Kat I wasn't contradicting myself. The JavaScript even called doesn't have to be a hover event, I want to change the system-blue color that shows when you hover over an option. @ Lonewolf217 Not excactly that, no, but I did describe it. Quote Link to comment https://forums.phpfreaks.com/topic/151641-change-select-color-of-option-elements/#findComment-798421 Share on other sites More sharing options...
RichardRotterdam Posted April 1, 2009 Share Posted April 1, 2009 @ Dj Kat I wasn't contradicting myself. The JavaScript even called doesn't have to be a hover event, I want to change the system-blue color that shows when you hover over an option. You still only mention a hover event. What other events do you have in mind. If you don't want to change anything on an event simply use CSS like darkfreaks mentioned. What do you mean with system-blue btw Quote Link to comment https://forums.phpfreaks.com/topic/151641-change-select-color-of-option-elements/#findComment-798447 Share on other sites More sharing options...
Jesper Posted April 6, 2009 Author Share Posted April 6, 2009 I don't mean javascript or css-events with events, I meant just regular events in a general way. When I touch my touch-screen, that's also an event. When the visitor hovers the mouse over the option, I want it to have another overlay-color than the regular system-blue: (check the color of the "Options..." field). Quote Link to comment https://forums.phpfreaks.com/topic/151641-change-select-color-of-option-elements/#findComment-802829 Share on other sites More sharing options...
Irate Posted June 28, 2013 Share Posted June 28, 2013 You can add an onchange event with JavaScript, like... window.onload = function(){ for(var i = 0; i < document.all.length; i++) { if(document.all[i].attachEvent) { document.all[i].attachEvent('onchange',myfunction); } else { document.all[i].addEventListener('change',myfunction); } } }; With that, you add an event listener for all HTML elements which fire onchange, just that you got to define myfunction, of course. Quote Link to comment https://forums.phpfreaks.com/topic/151641-change-select-color-of-option-elements/#findComment-1438374 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.