javascript - My IF loop does not stop -


i trying animated text output in html page. in javascript code, if statement not stop logic out of condition.

var wss_i = 0; var wss_array = ["programmer", "developer", "brother"]; var wss_elem;  function wssnext() {     wss_i++;     wss_elem.style.opacity = 0;     if (wss_i > (wss_array.length - 1)) {         wss_1 = 0;     }     console.log(wss_i);     settimeout('wssslide()', 1000); }  function wssslide() {     wss_elem.innerhtml = wss_array[wss_i];     wss_elem.style.opacity = 1;     settimeout('wssnext()', 2000); } 

correct variable should used.

use

wss_i = 0; 

instead of

wss_1 = 0; 

Comments

Popular posts from this blog

Android : Making Listview full screen -

javascript - Parse JSON from the body of the POST -

javascript - Chrome Extension: Interacting with iframe embedded within popup -