- Impact
- 18
Need help - javascript onmouseover rollover effects
Hi there.
Future Ventures - Local Marketing
If you have a look on that page the navigation has a fancy (although simple) rollover effect.
The problem is that the whole idea was that people would be able to mouseover the images (ie: about, portfolio, contact etc...) and it would display some content in the blue area below. So what I wanted was for the rollover effect to work when someone mouseover'd the different navigation options, then for it to stay like that if they dragged their mouse down into the blue area below, and only to revert back to the normal if they mouseout of the whole section.
I hope you understand, lol, its so difficult to explain. If anyone can point me in the right direction that would be good. Here is my code:
(disclaimer: please don't shout at me for using tables, I really don't understand divs :p)
Thank you all
Hi there.
Future Ventures - Local Marketing
If you have a look on that page the navigation has a fancy (although simple) rollover effect.
The problem is that the whole idea was that people would be able to mouseover the images (ie: about, portfolio, contact etc...) and it would display some content in the blue area below. So what I wanted was for the rollover effect to work when someone mouseover'd the different navigation options, then for it to stay like that if they dragged their mouse down into the blue area below, and only to revert back to the normal if they mouseout of the whole section.
I hope you understand, lol, its so difficult to explain. If anyone can point me in the right direction that would be good. Here is my code:
HTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Future Ventures - Local Marketing</title>
<script type="text/javascript">
if(document.images){
pic1=new Image();
pic1.src="home.gif";
pic2=new Image();
pic2.src="about_on.gif";
pic3=new Image();
pic3.src="packages_on.gif";
pic4=new Image();
pic4.src="portfolio_on.gif";
pic5=new Image();
pic5.src="contact_on.gif";
}
function roll_over(img_name, img_src)
{
document[img_name].src = img_src;
}
</script>
<style type="text/css">
body {
background: url('images/bg.gif');
background-repeat: repeat-x;
margin: 0;
font-family: Tahoma, Arial, Serif;
}
#nav {
text-align: center;
vertical-align: top;
height: 28px;
}
</style>
</head>
<body>
<center>
<table cellpadding="0" cellspacing="0">
<tr>
<td>
<img src="http://www.namepros.com/images/header.gif" alt="Future Ventures | Raise revenue, increase repeat custom and maximise profits" /></td>
</tr>
<tr>
<td id="nav">
<img src="http://www.namepros.com/images/divider.gif" />
<img src="http://www.namepros.com/images/home_on.gif" name="home" />
<img src="http://www.namepros.com/images/divider.gif" />
<img src="http://www.namepros.com/images/about.gif" name="about" onmouseover="roll_over('home','images/home.gif');roll_over('about','images/about_on.gif');" onmouseout="roll_over('home','images/home_on.gif');roll_over('about','images/about.gif');" />
<img src="http://www.namepros.com/images/divider.gif" />
<img src="http://www.namepros.com/images/packages.gif" name="pck" onmouseover="roll_over('home','images/home.gif');roll_over('pck','images/packages_on.gif');" onmouseout="roll_over('home','images/home_on.gif');roll_over('pck','images/packages.gif');" />
<img src="http://www.namepros.com/images/divider.gif" />
<img src="http://www.namepros.com/images/portfolio.gif" name="folio" onmouseover="roll_over('home','images/home.gif');roll_over('folio','images/portfolio_on.gif');" onmouseout="roll_over('home','images/home_on.gif');roll_over('folio','images/portfolio.gif');" />
<img src="http://www.namepros.com/images/divider.gif" />
<img src="http://www.namepros.com/images/contact.gif" name="contact" onmouseover="roll_over('home','images/home.gif');roll_over('contact','images/contact_on.gif');" onmouseout="roll_over('home','images/home_on.gif');roll_over('contact','images/contact.gif');" />
<img src="http://www.namepros.com/images/divider.gif" />
</td>
</tr>
</table>
</center>
</body>
</html>
Thank you all
Last edited: