It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming JavaScript Forum

for some reason this rollover code isn't working. NEED HELP!

for some reason this rollover code isn't working. NEED HELP!

Postby akbrody on Tue Apr 15, 2008 8:26 pm

<!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> &nbsp;&nbsp;
<a href="http://www.google.com/"><img src="images/button1_off.gif" border="0" alt="button2" id="button2" /> </a>


</body>



</html>
akbrody
 
Posts: 0
Joined: Tue Apr 15, 2008 8:20 pm

Postby nin2010 on Sun Apr 20, 2008 3:01 pm

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
nin2010
 
Posts: 3
Joined: Sun Apr 20, 2008 2:42 pm


Who is online

Users browsing this forum: No registered users and 5 guests

cron