473,387 Members | 1,760 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 bg of div1 when hovering div2

max
hello
(is this a css or a javascript question? or both?)
when hovering, I can change the background (bg) color of a field (div),
e.g.
http://www.bep-zuerich.ch/hover4.htm
with javascript I define, which div's of the navigation's secondary and
third level are visible or get hidden (not included in the example).
now I should be able to show the path gone through navigation levels:
when on field 'one', the bg changes to light grey.
when on field 'two', the bg of field 'one' should remain light grey,
that of 'two' become so.
when on field 'three', the bg of all three fields 'one', 'two' and
'three' should be light grey.
when unhovering, all bg should change back to dark grey.

how can I do this? thanks for any help. max.

Nov 13 '06 #1
1 1891
ASM
max a écrit :
hello
(is this a css or a javascript question? or both?)
It could be an interesting css question if IE is not used
except if as example given you use links in your divs.
when hovering, I can change the background (bg) color of a field (div),
e.g.
http://www.bep-zuerich.ch/hover4.htm
You only want this effect ?

CSS :
=====
#menu { list-style: none; display: inline; }
#menu li { margin: 0; padding: 0; width: 75px; }
#menu a { display: block; text-align: center;
text-decoration: none; color: white; background:#999;}
#menu a:hover { color: maroon; background: #ffc; }

HTML :
======
<ul id="menu">
<li><a href="page1.htm">menu 1</a></li>
<li><a href="page2.htm">menu 2</a></li>
<li><a href="page3.htm">menu 3</a></li>
</ul>
<hr style="clear:left;visibility:hidden" />
how can I do this? thanks for any help. max.
javascript:
===========
function roll(what) {
what.className = what.className=='grey'? 'light_grey' : 'grey';
}

CSS :
=====
..grey { background: #999; }
..light_grey { background: #ddd; }

html :
======
<input name="one" class="grey"
onmouseover="roll(this);" onmouseout="roll(this);" />
<input name="two" class="grey"
onmouseover="roll(this);" onmouseout="roll(this);"/>
<input name="three" class="grey"
onmouseover="roll(this);" onmouseout="roll(this);" />
See my contact form about focus, hover in inputs
(and help in JS for IE)

--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé
Stephane Moriaux and his (less) old Mac already out of date
Contact : http://stephane.moriaux.perso.wanadoo.fr/contact
Nov 13 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Yeah | last post by:
I have a multiple choice quiz where I would like to use CSS to change the color of the answers upon clicking them. I would like to present the right and wrong answers up front, rather than direct...
3
by: Steve Long | last post by:
I hope this isn't too stupid of a question but I'm looking for a way to change an item in a listview control when the mouse moves over it. I'd like to change its color and underline it for a...
3
by: teranews | last post by:
My question is this... Is 'LINK'ing a stylesheet required before 'IMPORT'ing another for successful hovering? I have a problem which cropped up with the introduction of IE 7 Beta 2... Yes.....
2
by: chris_culley | last post by:
Hi there, I've got a gif with (highly) irregular shapes (lots of jigsaw pieces) that I want to map so that each piece is a link... The pieces are currently just a frame drawing, but as they...
7
by: Giacomo | last post by:
I work on a page structured like: <h2> ... </h2> <div ="div1" class="show"> ... </div> <h2> ... </h2> <div id="div2" class="show"> ... </div> <h2> ... </h2> <div id="div3" class="show">...
0
by: empire5 | last post by:
Products Legal Support p1 L1 p2 L2 What would I do in MenuExample.css to change the top horizontal menu so the text Product Legal and Support is always white...
5
by: kimiraikkonen | last post by:
Hi, I couldn't find a necessary class which shows when mouse hovers on a link in Webbrowser control. Think of there's a status bar(text), when mouse comes on a link, the URL must be shown in...
10
by: The Bicycling Guitarist | last post by:
Hello. I have a navigation bar at the top of all my pages with css-styled buttons that change color when hovered over. I am a little confused on how to disable that for the link that the page is...
6
by: vinniemac | last post by:
Using javascript, how can I change an attribute for ALL anchors (A:hover) on the webpage?
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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.