?
Solved

DoEvents in VBScript?

Posted on 2002-05-08
5
Medium Priority
?
3,537 Views
Last Modified: 2008-02-07
I am running through a client side loop on an asp page. During each pass in this loop, I want to change the innerText of a div on the page. Trouble is, the text in the div never changes until the sub is complete, and the div text is whatever the loop last set it to. I know DoEvents is not included in VBScript, but that's the functionality I need. Does anyone know of something that achieves what DoEvents achieves? How can I get the page to display the changes I make while the sub is still executing?
0
Comment
Question by:jeffypop
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
5 Comments
 
LVL 29

Accepted Solution

by:
Göran Andersson earned 400 total points
ID: 6996917
Hm... this is not an ASP question at all...

Well, anyway, to make the display update, you have to end the script. To start a script automatically again to continue the loop, you add a timeout to the window object, with the delay of zero milliseconds.

This of course means that you have to code your loop somewhat differently. It has to be in a form of a sub that calls itself.

I made a small example, that loops from 1 to 100:

<html>
<head>

<script language="VBScript">

Sub counter(lngCnt)
     lngCnt=lngCnt+1
     document.all.CounterDiv.innerHTML=lngCnt
     If lngCnt<100 Then window.setTimeout "counter(" & lngCnt & ")",0
End Sub

</script>

</head>
<body onload="counter(0)">
<div id="CounterDiv"></div>
</body>
</html>
0
 
LVL 1

Expert Comment

by:giladBoker
ID: 6998314
u can use the client side for it to.

if u use javascript like that.

<script language=javascript>
var numOfLayer=0;
function ChangeDiv(){
  numOfLayer++;
  window.divName.innerText or innerHTML=numOfLayer

  setTimeOut('ChangeDiv()',500);//this reloads the function again every 500 mili seconds


if(numOfLayer==10){
   clearTimeOut();//stopps the automatic calling
   numOfLayer
}
}
</script>
0
 
LVL 1

Expert Comment

by:giladBoker
ID: 6998317
Sorry my answer is like greenGhost but just in javascript
0
 
LVL 15

Expert Comment

by:gladxml
ID: 8803107
No comment has been added lately and it seems that this question have been abandoned. So it's time to clean up this TA.

I will leave a recommendation in the Cleanup topic area that this question or invite a Moderator to close this question if there's no reply from you after seven days.

In the absence of responses, I will recommend the following:

To accept the comment and points awarded to GreenGhost

** PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER **


Just trying to help for the cleanup...
gladxml
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question