I'm having a bit of trouble with this script. I'm wondering if someone might
help me. What I'm trying to do is to have a multiple image rollover whereby
onmouseover, the image's source will cycle through a few pics and stop. I
got this part to work fine--it's the onmouseout part that I'm having some
difficulties with. I would like everything to be included within one
function, instead of two (one for mouseover and one for mouseout). Here is
what I have:
----------------------------------------------------------------------------
--------------------
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script type="text/javascript">
function
KP_multi_img_rollover(subject,navimg1,navimg2,navi mg3,navimg4,navimg5) {
var thesubject = document.getElementById(subject);
var theimgs = new Array(navimg1,navimg2,navimg3,navimg4,navimg5);
var i = 0;
var cycle = setInterval(cycler,300);
thesubject.onmouseout = clearInterval(cycle); setInterval(backcycler,300);
function cycler() {
if (i < theimgs.length-1) {
i = i + 1;
thesubject.src = theimgs[i];
}
else {
clearInterval(cycle);
}
}
function backcycler() {
if (i > 0) {
i = i - 1;
thesubject.src = theimgs[i];
}
else {
clearInterval(backcycler);
}
}
}
</script>
</head>
<body>
<img id="item1" src="TH_basement-entrance.jpg" width="118" height="90"
onMouseOver="KP_multi_img_rollover('item1','navpic 1.jpg','navpic2.jpg','navp
ic3.jpg','navpic4.jpg','navpic5.jpg');">
</body>
</html>
----------------------------------------------------------------------------
--------------------
Now, I realize the problem is with the "thesubject.onmouseout =
clearInterval(cycle); setInterval(backcycler,300);" statement, but I can't
figure out why it isn't working. I thought you could use event handlers as
object properties? Help would be appreciated--thanks.