Try
window.setInterval(function () {
bannerSwap(bannerNum++);
}, 5000);
Remove the bannerNum++ inside the bannerSwap function
EDIT
Your code doesn't work because you are not modifying the actual bannerNum
variable, but rather a parameter you recieve with the same name.
For your code to work entirely, you should do one of the following,
- Make all the modifications to
bannerNum
inside the setInterval function - Remove the parameter from the
bannerSwap
signature, so you gain scope of the global variable