63 users online (0 members and 63 guests)  

Thread: setTimeout ???


  Results 1 to 3 of 3
  1. #1
    Grand Mamamo's Avatar
    New User

    Status
    Offline
    Join Date
    Mar 2005
    Posts
    11

    Smile setTimeout ???

    Hi !

    could anyone explain me why

    setTimeout('crepiter()', 0)

    works, and

    crepiter()

    doesn't, in

    function crepiter()
    {
    index=Math.floor(Math.random()*chaine.length)
    crepite_chaine=crepite_chaine.replace(crepite_chaine.charAt(index), chaine.charAt(index))
    emplacement.innerHTML=crepite_chaine
    if(crepite_chaine!=chaine)
    setTimeout('crepiter()', 0)
    }

    Thanx for your explanations !

  2. #2
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662
    Hi, welcome to the forums.

    I'm not 100% sure, but calling the same function within a function causes a looping error, IIRC.

    What errors do you get with the version that doesn't work?
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?

  3. #3
    Grand Mamamo's Avatar
    New User

    Status
    Offline
    Join Date
    Mar 2005
    Posts
    11
    Thank you for your answer, QuietDean !



Tags for this Thread