开发者

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(func开发者_开发知识库tion(){
      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;


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.


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

  div.innerHTML = i;// use innerHTML 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜