Jump to content

Windows-based Javascript Error Using Settimeout


bigbang01

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.
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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...