PDA

View Full Version : Div containers changing background color when hovering over them?



brownleaf
08-24-2008, 03:06 AM
What I am trying to achieve is this:
http://www.pageresource.com/dhtml/jtut6.htm
Except with div containers rather than tables

Can that be achieved?
If so, how?
Could you link me to some tutorials?

wigadore
08-24-2008, 03:42 AM
Your link does not work. Repost so that we may see what you are trying to achieve

brownleaf
08-24-2008, 04:02 AM
Oops I'm sorry.

http://www.pageresource.com/dhtml/jtut6.htm

rangana
08-24-2008, 05:25 AM
<script type="text/javascript">
window.onload=function(){
var el=document.getElementById('el');
el.onmouseover=function(){this.style.backgroundColor='#9c0';}
el.onmouseout=function(){this.style.backgroundColor='#eee';}
}
</script>
<div id="el" style="background-color:#eee;">
I'm a div
</div>

brownleaf
08-24-2008, 05:59 AM
^
When I do that, the top and bottom part of the div container doesn't change color, only the middle strip. Also, it does not work in firefox.