Reputation: 2870
I user the innerHTML for the code:
<div>
<span id="tag"></span>
</div>
var i = 15;
function timer(){
var div = document.getElementById("tag");
i--;
setInterval(function(){
div.innerHTML = i;// use innerHTML
//div.removeChild(div.childNodes[0]);
//div.appendChild(document.createTextNode(i));
i--;
},15000);
}
timer();
the ff,safari,chrome is ok, but in ie8 value is no change;
Upvotes: 0
Views: 416
Reputation: 9929
Why don't you try using jQuery for this kind of operations (reading/writing to elements)? That library is designed mainly to take away all the fuss with different browsers and browser versions.
Upvotes: 1
Reputation: 672
Following semicolon is 2 byte character. try again after change to 1 byte character.
div.innerHTML = i;// use innerHTML
Upvotes: 1