setTimeout with parameters  [ 378 views ]

Goal: to find a compatible form of setTimeout calling with parameters

The general form is easy, but not working under ie…

  setTimeout(function(p1, p2, p3){
    console.log('parameters received: ' + p1 + ',' + p2 + ',' + p3);
  },
  1000,
  param1, param2, param3);

The following form is ie compatible…

  setTimeout(
    (function(p1, p2, p3){
      return function(){
        console.log('parameters received: ' + p1 + ',' + p2 + ',' + p3);
      }
    }(param1, param2, param3)),
  1000 );
#sidebar a { color:#fff; } #sidebar ul ul li { color: #DEF585; } #sidebar h2 { color: #fff; } #sidebar ul p, #sidebar ul select { color: #BEDDBE; } #backfly { background: url(images/golfBallWallPaper.jpg) left bottom fixed repeat-x #65a51d; }