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:



  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:

  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?

setTimeout(function(){dothislater(addthisvar)}, 3000);

Super, will look for it further tomorrow !

You should be nominated for this :wink: