How to solve Var out of scope within setTimeout call

前端 未结 4 2036
逝去的感伤
逝去的感伤 2020-12-13 15:58

I am trying to call a setTimeout from within a setInterval callback:

function callback()
{
   //assign myVar
   var myVar = document.getElementById(\"givenID         


        
4条回答
  •  没有蜡笔的小新
    2020-12-13 16:33

    Run it in Firefox and check Tools | Error Console. if setTimeout fails it may tell you why there.

    Also, try replacing "someFunction();" with "alert('hi')" (no semicolon) and see if that works. If so, the problem is narrowed down significantly.

提交回复
热议问题