PDA

View Full Version : I need to stop a function onmousedown


ONLYTONI
04-23-2005, 08:09 PM
Ok kids, I'm making a website that has a slide show running on it. The slide show starts onmouseover, but what I want is for it to stop onmousedown, of the slide, for certain reasons I do not wish to have the stop/start buttons. In that I'm having many many issues. I've spent hours trying to find some script on the interenet to help me but I have come up empty handed. here's the script tag and all therein:
<script language="JavaScript">
var i = 0;
var path = new Array();

// LIST OF SLIDES
path[0] = "chewwy.jpg";
path[1] = "4.jpg";
path[2] = "3.jpg";
path[3] = "2.jpg";

function swapImage()
{
document.slide.src = path[i];
if(i < path.length - 1) i++; else i = 0;
setTimeout("swapImage()",3000);
}
</script>

and what's inside the body tag as of right now:
<body><span onmouseover = "swapImage();"><img name="slide" height=390 width=380 src="chewwy.jpg"/></span>

</body>

This is a project that is due on Wednesday Apr. 27, 05. So the sooner I can get help the better. Much Thanks, Toni.

vwphillips
04-23-2005, 11:17 PM
try


vat TO=null;

function swapImage()
{
document.slide.src = path[i];
if(i < path.length - 1) i++; else i = 0;
TO=setTimeout("swapImage()",3000);
}

document.onmousedown=function(){ clearTimeout(TO);

</script>

ONLYTONI
04-24-2005, 03:22 AM
Thanks! Maybe you can come teach at Purdue...my professor never tells us anything useful like that...Toni