Forum Moderators: open
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
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