IE < 10 does not support elem.dataset
. You’d need to explicitly get the attribute: http://jsfiddle.net/ZSB67/1/.
changeBGImage(this.getAttribute('data-index'));
In the future, you might want pressing F12 and looking at the console for errors, since it said what was causing the problem here.