|
-
Please this code is not working for rollover and rollout events ?
Please this code is not working for rollover and rollout events ?
(rollover.html file)
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script type= "text/javascript" src="script.js"></script>
</head>
<body>
<a href="button1.html"><img src="images/button1_off.jpg" width="125" height="85" alt="Button1" id="button1"/></a>
<a href="button2.html"> <img src="images/button2_off.jpg" width="125" height="85" alt="button2" id="button2"/></a>
</body>
</html>
------------------------------------------------------------------------------------------------------------
(script.js file)
// JavaScript Document
window.onload=rolloverinit;
function rolloverinit()
{
for(var i=0; i<document.images.length; i++)
{
if(document.images.parentNode.tagName=="A")
{
setuprollover(document.images);
}
}
}
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.jpg";
thisimage.onmouseover=rollover;
}
function rollout(){
this.src=this.outimage.src;
}
function rollover(){
this.src=this.overimage.src;
}
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
|
Bookmarks