Welcome to WebmasterWorld Guest from 50.19.0.90

Forum Moderators: open

Message Too Old, No Replies

Animated "Loading." ?

     
7:34 am on Jun 13, 2008 (gmt 0)

Junior Member

5+ Year Member

joined:Jan 23, 2008
posts: 72
votes: 0


I simply want to display "Loading" with 3 periods after it. But, I'd like the periods to come in sequentially. Such as:

Loading.
Loading..
Loading...

So loading is always there but there's 1 period, then 2, then 3. And repeat. How do I do this?

8:31 am on June 13, 2008 (gmt 0)

Full Member

10+ Year Member

joined:Feb 4, 2004
posts:305
votes: 0


Try an animated GIF
9:48 am on June 13, 2008 (gmt 0)

Junior Member

5+ Year Member

joined:Jan 23, 2008
posts:72
votes: 0


lol

Okay, I was trying to not go that route since I've seen what I'm aiming for other places but you do have a point.
thanks

10:57 am on June 13, 2008 (gmt 0)

Preferred Member

5+ Year Member

joined:Feb 11, 2006
posts:481
votes: 0


Hi,

Try this:

<html>
<head>
<script type="text/javascript">
window.onload=function(){
var dotspan = document.getElementById('dots');
window.setInterval(function(){
if(dotspan.textContent == '...'){
dotspan.textContent = '.';
}
else{
dotspan.textContent += '.';
}
}, 1000);
}
</script>
</head>
<body>
<p>Loading<span id="dots">.</span>
</body>
</html>

Andrew

6:57 pm on June 13, 2008 (gmt 0)

Preferred Member

10+ Year Member

joined:July 5, 2005
posts:352
votes: 0


Do all browsers support textContent? And why use textContent instead of innerHTML? What are the advantages?
2:34 pm on June 14, 2008 (gmt 0)

Preferred Member

5+ Year Member

joined:Feb 11, 2006
posts:481
votes: 0


Hi,

No, I didn't check before, but IE doesn't support textContent. IE's equivalent of textContent is innerText rather than innerHTML.
I didn't use innerHTML because the text I was setting did not need to be interpreted as HTML (this might only save a couple of nanoseconds, but every little helps!). I used textContent because that's the standard [w3.org]. So the code I posted above will only work in standards compliant browsers.

Andrew

8:52 am on June 18, 2008 (gmt 0)

Junior Member

5+ Year Member

joined:Jan 23, 2008
posts:72
votes: 0


Oh, by the way, thank you G :) Works in Firefox, any people using IE can just see "Loading." without the extra cool animated dots till I fix it :D

lol

 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members