Jump to content

Windows-based Javascript Error Using Settimeout


Recommended Posts

Hi, I've got the following error with this external script code running under Windows XP:

setTimeout("test()",5000);function test(){  WScript.Echo("Hello world\n"); }

Runtime error:

Script C:\...\test.jsLine:1 Char: 1 Error: Object expected Code: 800A138F Source: Microsoft JScript runtime error
If I write "test();" instead of "setTimeout..." it's OK.Any hint to fix this up? Thank you. Edited by bigbang01
Link to comment
Share on other sites

It is worth remembering that all JS methods called (in the browser) without a related object are methods of the window instance created when the page loads. In effect, this is like having all your code surrounded by with(window) { ... }.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...