I have an array of three images. I want to call the function from onClick. Here's my code. I know can be done with jQuery but I'm just using plain JavaScript.
JavaScript
var myArray = ["_images/taste_logo_130w.gif","_images/logo.gif", "_images/winery_sign.jpg"];
var current = 0;
function imageTimer() {
if(current >= array.length) {
documnent.getElementById("logo").src = array[current];
current ++;
}
}
HTML
<img src="_images/logo.gif" id="logo" width="192" height="237" onClick=setInterval("imageTimer()", 3000); />
if(current >= array.length)should't it be lowerthen?setIntervalinstead of Interval