homepage Welcome to WebmasterWorld Guest from 54.205.7.136
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

    
Animated "Loading." ?
Br3nn4n




msg:3673777
 7:34 am on Jun 13, 2008 (gmt 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?

 

adb64




msg:3673807
 8:31 am on Jun 13, 2008 (gmt 0)

Try an animated GIF

Br3nn4n




msg:3673876
 9:48 am on Jun 13, 2008 (gmt 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

Little_G




msg:3673920
 10:57 am on Jun 13, 2008 (gmt 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

Trace




msg:3674306
 6:57 pm on Jun 13, 2008 (gmt 0)

Do all browsers support textContent? And why use textContent instead of innerHTML? What are the advantages?

Little_G




msg:3674756
 2:34 pm on Jun 14, 2008 (gmt 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

Br3nn4n




msg:3677380
 8:52 am on Jun 18, 2008 (gmt 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

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved