Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

refreshing a label

Status
Not open for further replies.

RichS

Programmer
Apr 24, 2000
380
US
I need to run through a loop a number of times showing the count of each loop in a label.

Is there a way to refresh just the label after each count?
 
I'm not sure what you mean by "label" but it sounds like you want to use a combination of DHTML and JavaScript to change layer contents. I can help with this if you want.
 
hie RichS
yeah, if u're talkin about layers then u shuld use innerHTML for ie & nn6.. regards, vic
 
I'm a newbie with web developement. I will check out your suggestions. Thanks for giving me the direction.

Rich
 
The easiest way to do what you want is to use a text field or textarea and change it's contents. That's very simple to do, and very cross-browser compatible. Tracy Dryden
tracy@bydisn.com

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
 
here is the code:

Code:
function loop() {
     var i=0
     for (i=0; i<1000; i++) {
          number.innerHTML = i;
     }
}


then on your page:

<span id=&quot;number&quot; style=&quot;position:relative&quot;>

but a loop is gonna go much to fast to produce any readable output so try this:

Code:
var i=0
function loop() {
          
     number.innerHTML = i;
     i++;
     setTimeout('loop()', 500);     
     
}
hope that helps
-Greg :-Q
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top