Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. IE and setTimeout...

IE and setTimeout...

Scheduled Pinned Locked Moved Web Development
question
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    RX Maverick
    wrote on last edited by
    #1

    setTimeout works great in Firefox, but I can't get IE to pass more than one argument. Does anyone know a trick?

    G S 2 Replies Last reply
    0
    • R RX Maverick

      setTimeout works great in Firefox, but I can't get IE to pass more than one argument. Does anyone know a trick?

      G Offline
      G Offline
      Guffa
      wrote on last edited by
      #2

      There is no trick needed. How are you trying to pass the arguments?

      Despite everything, the person most likely to be fooling you next is yourself.

      1 Reply Last reply
      0
      • R RX Maverick

        setTimeout works great in Firefox, but I can't get IE to pass more than one argument. Does anyone know a trick?

        S Offline
        S Offline
        Shog9 0
        wrote on last edited by
        #3

        setTimeout(function() { myfunc(param1, param2, param3); }, 300);

        ...should work in most browsers, and will call myfunc passing whatever you give it (in this case, param1, param2, param3); You could also write a helper function to make this a bit cleaner:

        function setTimeoutParam(ms, func)
        {
          var args = Array.prototype.slice.call(arguments, 2);
          setTimeout(function() { func.apply(this, args); }, ms);
        }

        ...which you can then call with the timeout value, function, and any number of desired parameters to that function, for example:

        setTimeoutParam(1000, alert, "called after 1 second");

        Citizen 20.1.01

        'The question is,' said Humpty Dumpty, 'which is to be master - that's all.'

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups