IE 9和IE 10不能随时在输入文本框中输入文本 [英] IE 9 and IE 10 cannot enter text into input text boxes from time to time

查看:106
本文介绍了IE 9和IE 10不能随时在输入文本框中输入文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有一个内置iframe的网页。有时,iframe内的输入文本框控件被锁定/冻结。用户不能输入文字。但文本框可以集中并且不会褪色。没有代码禁用输入控件,这并不总是会发生。到目前为止,这只发生在IE 9和IE 10中。Firefox和Chrome确定无误。



简要说明该页面的工作原理:




  • 父页面上有一个按钮。通过点击它将从头开始构建一个
    iframe并显示它。这是由Javascript完成的。

  • 同样,iframe上有一个按钮可以关闭它。通过点击它,
    将从父页面的DOM中移除iframe。 知道你是否需要进一步的信息。提前致谢。

    解决方案

    这个bug非常烦人,更糟糕的是我们在google上找不到任何信息。



    微软只有一个关于IE9的链接,但问题仍然存在于IE10 / IE11中,并且更容易重现。



    我刚刚创建了一个小提琴来描述这个问题。

    http ://jsfiddle.net/WilliamLeung/T3JP9/1/



    为什么M $很难解决这个问题多年?



    应该有三种解决方法


    1. 每次我们用iframe修改DOM时重置焦点

    2. 或安排一个无所事事的耗时任务,这可能会让IE对神奇的鼠标事件作出反应,我无法告诉你为什么,也许M $可以



      设置耗时任务的示例代码

        setInterval(function(){ 
      var l oopCount = 10000;
      var x = 0; (var i = 0; i x =(x + Math.random()* 1000)>
      >>>> 0;
      }
      return x;
      },1000);


    3. 或在将文档从文档中移除之前重置DOM内容

        someDivWithIframe.innerHTML =; 
      $(someDivWithIframe).remove();

      我不确定它是否有助于所有情况,您应该尝试



    There is a web page with an iframe inside. Sometimes, Input text box controls, inside the iframe, are locked/ freezed. Users cannot enter text into them. But the text box can be focused and not faded. There is no code to disable the input controls and this does not always happen. Up until now, this is happening only in IE 9 and IE 10. Firefox and Chrome is OK.

    Brief description of how the page works is:

    • There is a button on the parent page. By clicking it will build an iframe from scratch and show it. This is done by Javascript.

    • Again, there is a button on the iframe to close it. By clicking it
      will remove the iframe from the parent page's DOM.

    Please let me know if you want further information as required. Thanks in advance.

    解决方案

    This bug is very annoying, even worse there was very few informations we could find on google.

    There is only one link from Microsoft that about IE9, but problem still exists in IE10 / IE11 and much easier to reproduce.

    I have just create a fiddle to describe this problem

    http://jsfiddle.net/WilliamLeung/T3JP9/1/

    Why it is so hard for M$ to fix this issue for years?

    there should be three workarounds

    1. Reset the focus every time we modify the DOM with iframe
    2. or schedule a "do nothing" time consuming task, which may make IE response to mouse event magically, I could not tell you why, maybe M$ could

      The sample codes which setup a time consuming task

      setInterval(function () {
          var loopCount = 10000;
          var x = 0;
          for (var i = 0; i < loopCount; i++) {
              x = (x + Math.random() * 1000) >>> 0;
          }
          return x;
      }, 1000);
      

    3. or reset the DOM content before remove it from document

      someDivWithIframe.innerHTML = "";
      $(someDivWithIframe).remove();
      

      I am not sure if it helps for all cases, you should have a tried

    这篇关于IE 9和IE 10不能随时在输入文本框中输入文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆