Is it possible?

# Thread: Is it possible?

1. Senior Member
Join Date
Dec 1969
Posts
115

## Is it possible?

I wonder if it is possible to have a "time ticking .update" in ASP?<BR>Like something like this:<BR><BR>Dim nr1, nr2, total<BR>nr1 = 10<BR>nr2 = 1<BR>For each "5"minutes<BR>nr1 + nr2<BR>Response.Write nr1<BR><BR><BR>and in five minutes it would give a result: total = 11<BR><BR>Is this possible?<BR>the code I wrote is just for you to understand, it dosent work. <BR><BR>TNX<BR><BR> //xyron<BR>

2. Senior Member
Join Date
Dec 1969
Posts
2,809

## Hmmm...

Interesting exercise. Off the top of my head...<BR><BR>Dim intTimeOut, totalTime, intTemp, intIncrement<BR><BR>totalTime = 20 &#039;say 20 minutes<BR>intIncrement = 5 &#039;Check for every 5 minutes.<BR><BR>&#039;Set intTimeout for 20 minutes in the future<BR>intTimeOut = Dateadd("n",totaltime,Now())<BR><BR>intTemp = Dateadd("n",intIncrement,Now())<BR><BR>While Now() &#060;= intTimeOut<BR> If Now() &#062;= intTemp Then<BR> intTotal = intNumber1 + intNumber 2<BR> intTemp = Dateadd("n",intIncrement,Now())<BR> End If <BR>Wend<BR><BR>Not sure if it&#039;ll work or not. Really can&#039;t test it now, but give her a shot.

3. Senior Member
Join Date
Dec 1969
Posts
623

## RE: Is it possible?

A page is loaded from the server once and then the Server forgets that you ever requested the page... So timers and Servers are not best of friends. You can use a component for that though or use good ol&#039; client side code...<BR><BR>&#060;SCRIPT Language="JavaScript"&#062; <BR>function myTimer()<BR>{<BR> var theSum = thisVar + thatVar;<BR> window.theTimer.innerHTML = theSum;<BR> setTimeout("myTimer()", 300); <BR>} <BR>&#060;/SCRIPT&#062; <BR><BR>&#060;BODY onLoad="javascript: myTimer()"&#062;<BR> Tried it zillion times but my sum is still<BR> &#060;DIV ID="theTimer"&#062;&#060;/DIV&#062;<BR>&#060;/BODY&#062;

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•