beansandsausages Posted November 5, 2007 Share Posted November 5, 2007 Hi i was woundering is it possable to change the color of a drop down menu? Ill try explane , <select> <option>red</option> <option>blue</option> <option>black</option> </select> is it possable to like change the background of the option? If you get what im trien to say sorry im not to good at explaning Quote Link to comment Share on other sites More sharing options...
atlanta Posted November 5, 2007 Share Posted November 5, 2007 Ok so you mean when the user select red the background of the box turns RED??.. If so you will want to use javascript Quote Link to comment Share on other sites More sharing options...
beansandsausages Posted November 5, 2007 Author Share Posted November 5, 2007 yeah sumit like that, i mean say for example, if a option was : <select> <option>high</option> <---- background red <option>medium</option> <---- background green <option>low</option> <---- background yellow </select> if yo know what im trien to say hahaha Quote Link to comment Share on other sites More sharing options...
rlindauer Posted November 5, 2007 Share Posted November 5, 2007 <option style="background:#ff0000; color:#000000;">Red</style> Not really sure what you are asking. Quote Link to comment Share on other sites More sharing options...
atlanta Posted November 5, 2007 Share Posted November 5, 2007 Something simple that will change the background on your page when different level is selected <html> <script language="JavaScript"> <!-- var Color = new Array(); Color[1] = '#FF0000'; Color[2] = '#00FF00'; Color[3] = '#FFFF00'; function changeBG(myColor){ document.bgColor = Color[myColor]; } //--> </script> <select name="d" onChange="javascript:changeBG(this.value)"> <option value="1">High</option> <---- background red <option value="2">Medium</option> <---- background green <option value="3" selected>Low</option> <---- background yellow </select> </body> </html> Quote Link to comment Share on other sites More sharing options...
nafetski Posted November 5, 2007 Share Posted November 5, 2007 Not really anything to do with PHP...but =P <select> <option style="background:#ff0000; color:#000000;">Red</style> <option style="background:#0000a0; color:#000000;">Blue</style> <option style="background:#000000; color:#FFFFFF;">Black</style> </select> Maybe something like that is what you're looking for? Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted November 5, 2007 Share Posted November 5, 2007 Since this has nothing to do with PHP, I am moving it to the CSS area where the OP may get more meaningful answers. Ken Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted November 5, 2007 Share Posted November 5, 2007 This is the closest I've gotten to what I think the OP wants to do: <html> <head> <title>Option Color Test</title> <style> .option_red { background-color:red; color: white; } .option_blue { background-color: blue; color: white; } .option_black { background-color: black; color: white } </style> </head> <body> <form method="post"> <select name="test_color"> <option></option> <option>Normal</option> <option class="option_red">red</option> <option class="option_blue">blue</option> <option class="option_black">black</option> </select> </form> </body> Ken Quote Link to comment Share on other sites More sharing options...
beansandsausages Posted November 6, 2007 Author Share Posted November 6, 2007 Hey thank you, Sorry i posted in the wrong forum, hope your not mad at me, Quote Link to comment Share on other sites More sharing options...
beansandsausages Posted November 6, 2007 Author Share Posted November 6, 2007 That works. thank you very much, Quote Link to comment 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.