Hi RHL,
Its better to use
setTimeout()
instead of
setInterval() since it better suits your requirement.
This is how you can do it
var timer = setTimeout("yourFunc()", 5000);
function yourFunc()
{
if(timer)
clearTimeout(timer);
}
Note: If you use setInterval() then you need to use clearInterval() function to stop the timer
Hope this helps you a bit.
Regards,
RK