var imgnumb = 1;
function imgfor() {
imgnumb ;
document.getElementById('img1').setAttribute('src', 'images/' imgnumb '.jpg');
if (imgnumb == 5) {
imgnumb = 0;
}
}
var clearid;
function clearfun() {
clearInterval(clearid);
}
clearid=setInterval(imgfor, 500);