Thickbox3.1弹出层关闭再打开,文本框不能输入,即无法聚焦
2009-12-21 文章来源:互联网 浏览次数:2223
分享文章
症状:关闭弹出层后,原来页面上的文本框无法聚焦,即文本框变成readyonly(只读)了
原因和解决方法:这个的原因不好说,很多人都认为是ie本身的bug。是由于iframe没有移除,即使移除了。内存上也么有清除造成的。这也是我猜的。哈哈。解决方法是在tb_remove()中先手动移除iframe然后,在强制做垃圾回收,至少我是可以啦。哈哈。代码如下:
- function tb_remove() {
- $("#TB_imageOff").unbind("click");
- $("#TB_closeWindowButton").unbind("click");
- $("#TB_window").fadeOut("fast",function(){
- if(navigator.userAgent.indexOf("MSIE")>0) { //如果是IE
- //手动移除iframe,IE的一个bug
- $('#TB_iframeContent').remove();
- }
- $('#TB_window,#TB_overlay,#TB_HideSelect').trigger("unload").unbind().remove();
- if(navigator.userAgent.indexOf("MSIE")>0) { //如果是IE
- //自己调用垃圾回收,强制清楚iframe内存,解决文本框无法输入问题。
- CollectGarbage();
- }
- });
- $("#TB_load").remove();
- if (typeof document.body.style.maxHeight == "undefined") {//if IE 6
- $("body","html").css({
- height: "auto",
- width: "auto"
- });
- $("html").css("overflow","");
- }
- document.onkeydown = "";
- document.onkeyup = "";
- return false;
- }

文章评论(查看全部)