Forcing a DOM refresh in Internet explorer after javascript dom manipulation

前端 未结 6 1077
感情败类
感情败类 2020-11-27 18:07

Here is the situation. I have some javascript that looks like this:

function onSubmit() {
    doSomeStuff();
    someSpan.style.display=\"block\";
    otherS         


        
6条回答
  •  夕颜
    夕颜 (楼主)
    2020-11-27 18:23

    To continue what ChrisW says:

    here's flushing script to flash DOM, so you don't have to call alert(""); (found at http://amolnw.wordpress.com/category/programming/javascript/):

    function flushThis(id){
       var msie = 'Microsoft Internet Explorer';
       var tmp = 0;
       var elementOnShow = document.getElementById(id);
       if (navigator.appName == msie){
          tmp = elementOnShow.parentNode.offsetTop  +  'px';
       }else{
          tmp = elementOnShow.offsetTop;
       }
    }
    

    It works for me!!! Thanks for the tip.

提交回复
热议问题