What is wrong with this code:
Code:
var i = 0;

function time() {
	window.setInterval(change(), 5000);
}

function change() {
	i++;
	if (i = 1) {
		document.getElementById("slider").src="img/index/Image1.jpg";
	}
	else if (i = 2) {
		document.getElementById("slider").src="img/index/Image2.jpg";
	}
	else if (i = 3) {
		document.getElementById("slider").src="img/index/Image3.jpg";
	}
	else if (i = 4) {
		document.getElementById("slider").src="img/index/Image4.jpg";
	}
	else if (i = 5) {
		document.getElementById("slider").src="img/index/Image5.jpg";
	}
	else if (i = 6) {
		document.getElementById("slider").src="img/index/Image6.jpg";
	}
	else if (i = 7) {
		document.getElementById("slider").src="img/index/Image7.jpg";
	}
	else if (i = 8) {
		document.getElementById("slider").src="img/index/Image8.jpg";
	}
	else if (i = 9) {
		document.getElementById("slider").src="img/index/Image9.jpg";
	}
}
I need some images to change every 5 seconds. I called "time()" when the body tag loads.