Thinking80s
Thinking80s

Reputation: 2870

innerHTML in ie6/ie7 bug?

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

Answers (2)

Bas Slagter
Bas Slagter

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

Msyk
Msyk

Reputation: 672

Following semicolon is 2 byte character. try again after change to 1 byte character.

  div.innerHTML = i;// use innerHTML 

Upvotes: 1

Related Questions