SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Addict
    Join Date
    Dec 2008
    Location
    Brussels
    Posts
    377
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    delayed function with vbscript inserted values

    Hi all,

    I've made a script for an intraweb, where I use VBScript aswel. (It's IE only)
    I need that VBScript to get some data from excel files... but then again, this data is passed to javascript where I use it in scripts.

    Everything works fine like this, when I pass the VB variable (shiftVB) to a javascript variable addthisvar:
    Code JavaScript:
     
      var addthisvar = shiftVB;
     
     
      function dothisnow(addthisvar){
      alert(addthisvar);
      }
     
     dothisnow(addthisvar);

    But, when I delay this, it doesn't work anymore... doesn't give a popup. Only the message: 'done but with errors' in the statusbar:
    Code JavaScript:
      var addthisvar = shiftVB;
     
     
      function dothislater(addthisvar){
      alert(addthisvar);
      }
     
      setTimeout("dothislater(addthisvar);",3000);

    This is just an example, the total script is quite large, but even if I make this variable from a global to a local inside the function, it only works at the moment itself, but if it's delayed, it does not store it's value.

    Anyone can help?

  2. #2
    SitePoint Zealot
    Join Date
    May 2009
    Location
    Netherlands
    Posts
    189
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    setTimeout(function(){dothislater(addthisvar)}, 3000);

  3. #3
    SitePoint Addict
    Join Date
    Dec 2008
    Location
    Brussels
    Posts
    377
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Super, will look for it further tomorrow !

    You should be nominated for this


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •