This code provide a dot effect, like a loading bar(” Loading., Loading.., Loading…), but the problem , that only one single span id works, the second one wont, i dont know why…
please help me out guys
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
<!--
function showProgressDots(numberOfDots) {
var progress = document.getElementById('progressDots');
switch(numberOfDots) {
case 1:
progress.innerHTML = '.';
timerHandle = setTimeout('showProgressDots(2)',200);
break;
case 2:
progress.innerHTML = '..';
timerHandle = setTimeout('showProgressDots(3)',200);
break;
case 3:
progress.innerHTML = '...';
timerHandle = setTimeout('showProgressDots(1)',200);
break;
}
}
window.setTimeout('showProgressDots(1)',100);
//-->
</SCRIPT>
Loading<span id="progressDots" style="position:absolute;"></span>
SecondLoading<span id="progressDots" style="position:absolute;"></span>
Just posting a little plugin i made for this (for the fun of it..).
You use it with
with available
optionsbeingsymbolthe character to add on each iterations (default is.)lengththe max number of symbols to display before it starts over (default is 3)delaythe time it takes for each extra symbol to be added (in milliseconds) (default is 200)durationtotal duration (in milliseconds) before clearing the plugin (default is 0 which means no auto clearing)example points to jsfiddle
update for comment
To clear it automatically after some specific time just add a timeout to your code..
so
update for 2nd comment
changed the plugin code above to allow for a
durationparameter.If specified, it declares the time after which the plugin will automatically clear..
Demo at http://jsfiddle.net/gaby/gh5CD/3/ (the second loader will clear after 2 seconds)