Using a timer

T

tedpottel

Hi,
I have the follllowing code on micrsoft explore with the debuger turn
on

<script language="javascript">

setTimeOut( alert('ko'), 50000);

</script>

There seems to be no pause with the alert box comming up, and I keep
getting a error saying " Obkect expecdted",
Helppppp
-Ted
 
S

Stevo

Hi,
I have the follllowing code on micrsoft explore with the debuger turn
on

<script language="javascript">

setTimeOut( alert('ko'), 50000);
setTimeout lower case o
 
H

Hamish Campbell

Hi,
I have the follllowing code on micrsoft explore with the debuger turn
on

<script language="javascript">

setTimeOut( alert('ko'), 50000);

</script>

There seems to be no pause with the alert box comming up, and I keep
getting a error saying " Obkect expecdted",
Helppppp

See:

http://msdn.microsoft.com/en-us/library/ms536753(VS.85).aspx

The first argument is a "Variant that specifies the function pointer
or string that indicates the code to be executed when the specified
interval has elapsed.".

The following should work:

// As a string
window.setTimeout("alert('ko')", 50000);

// As a function pointer
var fn = function() { alert("hi") };
window.setTimeout(fn, 1000);
 
T

Thomas Fuchs

Hi,
I have the follllowing code on micrsoft explore with the debuger turn
on

<script language="javascript">

setTimeOut( alert('ko'), 50000);

</script>

Three lines of code and you got everything wrong. The type attribute is
missing, the language attribute is deprecated, the o has to be lower
case and the alert-call must be surrounded by quotes.

Where the f**k did you learn that?
There seems to be no pause with the alert box comming up, and I keep
getting a error saying " Obkect expecdted",

Well, that's because you write your code like you write your posting in
usenet. You have to abide by the syntax of the language you use.
 
S

SAM

Le 7/7/09 11:00 PM, Hamish Campbell a écrit :
The following should work:

// As a string
window.setTimeout("alert('ko')", 50000);

// As a function pointer
var fn = function() { alert("hi") };
window.setTimeout(fn, 1000);


// As a function
setTimeOut( function() { alert('ko'); }, 50000);

and 50000 = wait during 50 seconds (not a little long delay ?)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,098
Messages
2,570,625
Members
47,236
Latest member
EverestNero

Latest Threads

Top