Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

SetIntervalin vbscript

Posted on 2002-07-17
6
Medium Priority
?
200 Views
Last Modified: 2010-04-09
Hi,
Can anyone tell me the solution to this:
I have text fading from white to blue using the setInterval function.

I have:
fontint = setInterval("changeColor",50)


Sub changeColor()
... Then the rest of the code to change the color

It works fine but when it's finished fading I want setInterval to stop. It continues calling that function after it's finished.
Microsoft DHTML documentation says (about SetInterval):
"Returns an integer identifier representing the interval. Use this identifier to clear (stop) the interval."

I have tried setting fontint to null and zero but it makes no difference. I have also tried this:
fontint = setInterval("changeColor",0)

and this,

fontint = setInterval("",0)


Please any ideas would be very welcome.
Thanks,
Rhods.

0
Comment
Question by:Rhods
[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
6 Comments
 
LVL 33

Expert Comment

by:knightEknight
ID: 7160438
instead of using setInterval, call setTimeout from the sub like this:


   sub changeColor

     'your change-color code here

     if ( notFinishedFading ) then
        setTimeout("changeColor",50)
     end if

   end sub



and instead of this,

   fontint = setInterval("changeColor",0)

just do this

   call changeColor
0
 
LVL 22

Accepted Solution

by:
CJ_S earned 1200 total points
ID: 7164230
declare global:
dim myinterval

myinterval = setInterval("changecolor", 100)

and to stop:
clearInterval(myinterval)

CJ
0
 
LVL 22

Expert Comment

by:CJ_S
ID: 7171215
Any update?
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 7240664
This question has been abandoned. I will make a recommendation to the
moderators on its resolution in a week or two. I appreciate any comments
that would help me to make a recommendation.
<note>
   In the absence of responses, I may recommend DELETE unless it is clear
   to me that it has value as a PAQ.  Silence = you don't care
</note>

Cd&

0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 7270978
It is time to clean this abandoned question up.  

I am putting it on a clean up list for CS.

<recommendation>
points to CJ_S

</recommendation>

If anyone participating in the Q disagrees with the recommendation,
please leave a comment for the mods.

Cd&
0
 
LVL 5

Expert Comment

by:Netminder
ID: 7297712
Per recommendation, force-accepted.

Netminder
CS Moderator
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

This article discusses how to create an extensible mechanism for linked drop downs.
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

715 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