tomyknoker
06-27-2003, 06:29 AM
Hi I have this code with simple rollovers...ie when you rollover the first button it goes green...but as you roll over the first button, I also want an image next to it to show and when rollout dissappear...I want to try and make this happen for all for buttons...And also when the page loads the image that turns on from the first button...must already be on...here is the code:
<HTML>
<HEAD>
<TITLE>Horses</TITLE>
</HEAD>
<SCRIPT language="JavaScript">
<!-- Hide from older browsers
var home1 = new Image(250, 100);
home1.src = "images/home1.gif";
var home2 = new Image(250, 100);
home2.src = "images/home2.gif";
var about1 = new Image(250, 100);
about1.src = "images/about1.gif";
var about2 = new Image(250, 100);
about2.src = "images/about2.gif";
var contact1 = new Image(250, 100);
contact1.src = "images/contact1.gif";
var contact2 = new Image(250, 100);
contact2.src = "images/contact2.gif";
var location1 = new Image(250, 100);
location1.src = "images/location1.gif";
var location2 = new Image(250, 100);
location2.src = "images/location2.gif";
function change(imageName, imagesrc) {
document.images[imageName].src = imagesrc.src;
}
// Stop Hiding -->
</SCRIPT>
<BODY>
<A HREF="#" onMouseover="change('home', home2);"onMouseout="change('home', home1);"><IMG name="home" src="images/home1.gif" width="250" height="100" border="0"></A>
<BR>
<BR>
<A HREF="#" onMouseover="change('about', about2);"onMouseout="change('about', about1);"><IMG name="about" src="images/about1.gif" width="250" height="100" border="0"></A>
<BR>
<BR>
<A HREF="#" onMouseover="change('contact', contact2);"onMouseout="change('contact', contact1);"><IMG name="contact" src="images/contact1.gif" width="250" height="100" border="0"></A>
<BR>
<BR>
<A HREF="#" onMouseover="change('location', location2);"onMouseout="change('location', location1);"><IMG name="location" src="images/location1.gif" width="250" height="100" border="0"></A>
</BODY>
</HTML>
<HTML>
<HEAD>
<TITLE>Horses</TITLE>
</HEAD>
<SCRIPT language="JavaScript">
<!-- Hide from older browsers
var home1 = new Image(250, 100);
home1.src = "images/home1.gif";
var home2 = new Image(250, 100);
home2.src = "images/home2.gif";
var about1 = new Image(250, 100);
about1.src = "images/about1.gif";
var about2 = new Image(250, 100);
about2.src = "images/about2.gif";
var contact1 = new Image(250, 100);
contact1.src = "images/contact1.gif";
var contact2 = new Image(250, 100);
contact2.src = "images/contact2.gif";
var location1 = new Image(250, 100);
location1.src = "images/location1.gif";
var location2 = new Image(250, 100);
location2.src = "images/location2.gif";
function change(imageName, imagesrc) {
document.images[imageName].src = imagesrc.src;
}
// Stop Hiding -->
</SCRIPT>
<BODY>
<A HREF="#" onMouseover="change('home', home2);"onMouseout="change('home', home1);"><IMG name="home" src="images/home1.gif" width="250" height="100" border="0"></A>
<BR>
<BR>
<A HREF="#" onMouseover="change('about', about2);"onMouseout="change('about', about1);"><IMG name="about" src="images/about1.gif" width="250" height="100" border="0"></A>
<BR>
<BR>
<A HREF="#" onMouseover="change('contact', contact2);"onMouseout="change('contact', contact1);"><IMG name="contact" src="images/contact1.gif" width="250" height="100" border="0"></A>
<BR>
<BR>
<A HREF="#" onMouseover="change('location', location2);"onMouseout="change('location', location1);"><IMG name="location" src="images/location1.gif" width="250" height="100" border="0"></A>
</BODY>
</HTML>