hey , i got 2 function , the one working and the other one is'nt
heres the functions :
the first function works ( keep printing "f" every 0.5 sec )
the second function only work once and than stop ( print "d" and than stop )
what's the problem with the second function?
thanks , Mor.
heres the functions :
Code:
var toDisplay = "f"; function human(){ var toAdd = toDisplay.substring(0,1); setTimeout(human , 500); document.getElementById('box').innerHTML += toAdd; } human(); // works (display "f" every half a sec) function human2(toDisplay2){ var toAdd = toDisplay2.substring(0,1); var t = setTimeout("human2(toDisplay2)" , 500); document.getElementById('box').innerHTML += toAdd; } human2("dsd"); // not working (only display "d" and stop)
the second function only work once and than stop ( print "d" and than stop )
what's the problem with the second function?
thanks , Mor.
Comment