473,387 Members | 1,578 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

change background color onclick

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
6 16376
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
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
You can do it with CSS but JS will do it easier, glog

Later
Nov 18 '06 #4
asoft
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
7,435 Expert 4TB
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
1,137 1GB
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

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

Similar topics

1
by: Spike | last post by:
Hello! Im going to make a javascript for changing alot of images. But im not sure how to do it., where to start.. Ok, first.. this is the isue. I have 3 images(I call them 1a-3a). when u...
1
by: Michael | last post by:
How can I use onclick to change a table cell background color. I know I can use this.className=? to change the classname. But then I would have to put the code into every single table cell. I...
2
by: RWD | last post by:
I am trying to figure out how to change the target frame in my hyperlink on a DHTML menu. The menu is in one frame and the target frame is called "main" The code is below: Thanks in advance...
5
by: AFN | last post by:
I'm trying to set a submit button to change text and color when clicked. Like saying "please wait" instead of "submit" and then changing the background color and text color. All works, except for...
13
by: Gary | last post by:
I have a table with a form consisting of several checkboxes and I'm wondering if its possible to change the table row background color on mouseover or hover and make it stay that color when the...
2
by: Scott | last post by:
Is it possible to have a button change colour OnClick ? Thanks.
10
by: IchBin | last post by:
I am trying to set the state of a radio button. I do not see what I am doing wrong. Sorry, I am new at this.. I need another set of eyes to look at this snip of code. I am trying to set the radio...
3
by: vj | last post by:
how to change images based on action. Even clicking changed images should do respective actions. and while displaying only one image at a time sholud get displayed. I am using three images for a...
10
by: apparker | last post by:
I'm creating a new GUI for a program and it is for a medical exam. There are so many different things to ask someone during a history it wastes too much space to make checkboxes for everything so I...
18
by: wizdom | last post by:
Help - change text on click - text has another onclick inside with php variables ---------- I think what I'm trying to do is simple. I have a 2 buttons on a page. 1 button allows a thread of...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.