Forum Moderators: open

Message Too Old, No Replies

i need help with a timer in asp

         

popo

8:47 am on Jun 9, 2004 (gmt 0)

10+ Year Member



I want to set a timer, that will redirect me to anothere page with in 3 seconds from the moment i activet the script. how can I do that?

le_gber

11:15 am on Jun 9, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi popo and welcome to WebmasterWorld,

How would you activate the script?

If it's by clicking on a button (for example) you could use javascript rather than asp.
Have a look on Google for javascript timer it gives good results.

If it's 3 sec after a page is loaded you could use the meta refresh.

Hops this helps

Leo

popo

11:44 am on Jun 9, 2004 (gmt 0)

10+ Year Member



hello to you to Leo =)
the script activet after I add new member in to the database, I already know how to do that with javascript. but I want to use asp so if u or anyone else know how ill be glad to get some help =)

Easy_Coder

3:36 pm on Jun 9, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



isolate the time...
loop until the time is equal to the isolation + 3

Take a look at these instrinsic functions:
Hour(Now())
Minute(Now())
and the one I believe will help you is:
Second(Now())

Krapulator

5:40 am on Jun 10, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member




<%
Sub Delay(DelaySeconds)

dim SecCount, Sec2,Sec1

SecCount = 0
Sec2 = 0
While SecCount < DelaySeconds + 1
Sec1 = Second(Time())
If Sec1 <> Sec2 Then
Sec2 = Second(Time())
SecCount = SecCount + 1
End If
Wend

End Sub
%>

Acitive the sub in your script

<%
Call Delay(3)
Response.redirect "wherever.htm"
%>

duckhunter

4:27 am on Jun 11, 2004 (gmt 0)

10+ Year Member



Careful with that loop. Your CPU will spike to 100% during that operation and will bring the server to it's knees.

.NET offers some good options if it's available to you.

If it must be done in ASP javascript or a COM call to a DLL are pretty much it. VB/C+ have thread safe timers available that truly sleep instead of loop until done.