Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript_howto thread: ASP Page calling VBScript from JavaScript's SetInterval?


Message #1 by "Rob" <info@i...> on Sat, 1 Mar 2003 15:35:58 -0600
For a simple solution you could have an iframe in your main page with the
meta tag refresh set to 15 seconds. In the iframe page have (replace
"skript" with "script":
<skript type="text/javascript">
  var openNewPage = <% = getDatabaseValue %>;
  if (openNewPage)
  {
    //do whatever here, e.g. top.location.href = "some.htm".
  }
</skript>

make sure your function returns either "true" or "false" as a string. This
will result in the database being polled every 15 seconds and if it returns
true the code exceuted. It won't affect the main page until it has to.
You simply can't do what you want with "setInterval" (note spelling) as the
VBScript must be run on the server.

Joe

----- Original Message ----- 
From: "Rob Levs" <info@i...>
To: "JavaScript HowTo" <javascript_howto@p...>
Sent: Sunday, March 02, 2003 1:33 PM
Subject: [javascript_howto] Re: ASP Page calling VBScript from JavaScript's
SetInterval?


> Thanks for the response Joe.
>
> I'm targeting IE 4 and above.
>
> The two solutions you propose look feasable, but perhaps beyond my
> expertise.
>
> What if I return the necessary data to the client side, before I process?
> I'm only looping through the data checking for one value which is already
> a session variable.  The data I'm looking at, I was planning on placing
> into a two dimensional array within an application variable anyway.  I was
> using the database approach only for testing.  Apparantly the difference
> between processing through a database and processing through an array, was
> a costly oversight!
>
> It seems now that merely need the routine to give me is a "true"
> or "false" every 10 or 15 seconds.  With a "true" I would open a new
> page.  The reason I don't want a refresh is that 99.9% of the time I'm
> getting a false.
>
> For me it would be much easier to handle this type of  array with with
> VBScript because it is what I know best.  Either way wouldn't this put me
> in a Position where I could accomplish my goal by calling the VBScript
> Routine which loops through the array from a JavaScript SetTimeout or
> SetInterval?
>
> Rob
>

  Return to Index