By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,687 Members | 2,065 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,687 IT Pros & Developers. It's quick & easy.

change background color onclick

P: 3
I have created a vertical menu with a white background, once a link is clicked i want that menu item's background color to change. Then once another menu item is clicked the first menu items background goes back to white and the new item's background color changes. I guess i want something similar to gmail's navigation. I am just wondering if that is possible in CSS, and maybe some code or help on how to tackle this. Thanks in advance for any information.
Nov 17 '06 #1
Share this Question
Share on Google+
6 Replies


dswethar
P: 65
Hi,

By "Click", do you mean rollover or when the page is showing that menu item? Eg: Do you want the "Service1" menu item to change when the "Service1" page is opened?

You can check for different kinds of menu at: http://www.dynamicdrive.com/style/cs...y/category/C2/
Nov 17 '06 #2

dreamcatcher
P: 16
Yea that's possible css alright.

I think I know what you're wanting to achieve.

Basically, use the hover to enable the link that's being clicked on to change the colour of the background. Use a class to show the current link that's active.

I found a solution to something similar a while ago on http://www.htmldog.com/articles/suckerfish/dropdowns/

I've implemented it on http://www.wallswelldrilling.ie/index2.htm, feel free to look around the code. It'll do exactly what you want using css, in xhtml, it's accessible too and validates.


I have created a vertical menu with a white background, once a link is clicked i want that menu item's background color to change. Then once another menu item is clicked the first menu items background goes back to white and the new item's background color changes. I guess i want something similar to gmail's navigation. I am just wondering if that is possible in CSS, and maybe some code or help on how to tackle this. Thanks in advance for any information.
Nov 17 '06 #3

TheMadMidget
P: 98
You can do it with CSS but JS will do it easier, glog

Later
Nov 18 '06 #4

P: 1
Hi
I did it but when it work with frame hillighted link color disappear what it reason plz some help

Thanks
Nov 19 '07 #5

drhowarddrfine
Expert 5K+
P: 7,435
The first part is easy with CSS but don't recall how to do the second, or if it's possible. You should look at listamatic.com or CSSPlay to see if something is there.
Nov 19 '07 #6

Death Slaught
100+
P: 1,137
Start this in a sec I know I've seen this somewhere before in a book I have.

Sorry can't find it, but you should be able to do this is JavaScript, I would go ask over there.

Thanks, Death
Nov 19 '07 #7

Post your reply

Sign in to post your reply or Sign up for a free account.