| View previous topic :: View next topic |
| Author |
Message |
akbrody
Joined: 15 Apr 2008 Posts: 1
|
Posted: Tue Apr 15, 2008 9:26 pm Post subject: for some reason this rollover code isn't working. NEED HELP! |
|
|
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>RolloverExample</title>
<script language="javascript" type="text/javascript">
window.onload = RolloverInit()
function RolloverInit(){
for (var i=0; i<document.images.length; i++){
if (document.images[i].parentNode.tagName == "A"){
setupRollover(document.images[i])
}
}
}
function setupRollover(thisImage){
thisImage.outImage=new Image();
thisImage.outImage.src = thisImage.src;
thisImage.onmouseout = rollOut;
thisImage.overImage= new Image();
thisImage.overImage.src = "images/"+thisImage.id+"_on.gif";
thisImage.onmouseover = rollOver;
}
function rollOver(){
this.src=this.overImage.src;
}
function rollOut(){
this.src=this.outImage.src;
}
</script>
</head>
<body>
<a href="http://www.yahoo.com/"><img src="images/button1_off.gif" border="0" alt="button1" id="button1" /> </a>
<a href="http://www.google.com/"><img src="images/button1_off.gif" border="0" alt="button2" id="button2" /> </a>
</body>
</html> |
|
| Back to top |
|
 |
|
|
nin2010
Joined: 20 Apr 2008 Posts: 3
|
Posted: Sun Apr 20, 2008 4:01 pm Post subject: Re: for some reason this rollover code isn't working. NEED HELP! |
|
|
Heya,
I used the tutorial on this website to create javascript rollover images. It was pretty straight forward to follow. You can post in this thread if your having problems figuring it out.
http://www.yourhtmlsource.com/images/rollovers.html |
|
| Back to top |
|
 |
|