PDA

View Full Version : Stopping rotating function


drej
10-09-2002, 03:57 PM
I am using the following script to rotate images:

adImages = new Array("<%=ServerPath %>/global_images/headerimage_commwork.jpg", "<%=ServerPath %>/global_images/headerimage_ft.jpg","<%=ServerPath %>/global_images/headerimage_empcomm.jpg","<%=ServerPath %>/global_images/headerimage_customtrain.jpg", "<%=ServerPath %>/global_images/headerimage_commstaff.jpg")
thisAd = 0
imgCt = adImages.length

function rotate() {
if (document.images) {
thisAd++
if (thisAd == imgCt) {
thisAd = 0
}
document.services.src=adImages[thisAd]
setTimeout("rotate()", 5 * 1000)
}
}

I want to shut this off when the mouse moves over an image on the page. How do I stop this function on mouse over? I'm starting it onLoad.

Thanks.

beetle
10-09-2002, 04:34 PM
window.timeout = setTimeout("rotate()", 5 * 1000) ;

<img onMouseOver="if (window.timeout) clearTimeout(window.timeout);">