解决thickbox关闭后,文本框无法聚焦的问题

症状:关闭弹出层后,原来页面上的文本框无法聚焦

原因和解决方法:这个的原因不好说,很多人都认为是ie本身的bug。是由于iframe没有移除,即使移除了。内存上也没有清除造成的。这也是我猜的。哈哈。解决方法是在tb_remove()中先手动移除iframe然后,在强制做垃圾回收。代码如下:

 1function tb_remove() {
 2    var seq=PopSeq();
 3     $("#TB_imageOff"+seq).unbind("click");
 4     $("#TB_closeWindowButton" + seq).unbind("click");
 5
 6     $("#TB_window" + seq).fadeOut("fast", function() {
 7         ///手动移除ifrmae,IE的一个bug
 8         $('#TB_iframeContent' + seq).remove();
 9         $('#TB_window' + seq + ',#TB_overlay' + seq + ',#TB_HideSelect' + seq).trigger("unload").unbind().remove();
10        ///自己调用垃圾回收,强制清楚iframe内存,解决文本框无法输入问题。
11         CollectGarbage();
12     }
);
13    if (typeof document.body.style.maxHeight == "undefined"{//if IE 6
14        $("body","html").css({height: "auto",  "auto"});
15        $("html").css("overflow","");
16    }

17    document.onkeydown = "";
18    document.onkeyup = "";
19    return false;
20}
原文地址:https://www.cnblogs.com/younggun/p/2322685.html