In IE6, the text box "frequently" in the Iframe layer is displayed, and the input focus cannot be obtained.

Source: Internet
Author: User

The company's WEB project must be compatible with FF3, IE6/7/8. This article describes a BUG in IE6.

A self-encapsulated pop-up layer is written in the project. The principle is to dynamically Add a mask layer, and then dynamically Add a DIV (Table) layer (PNG translucent border effect of the pop-up layer ), add an IFrame dynamically in the DIV. The Iframe page points to an existing HTM file.

If the HTM file contains some form elements such as text input boxes, ie6.

The tester said that after the pop-up layer is opened, the focus of the text box cannot be obtained "frequently", that is, the Focus cannot be obtained from the text box by clicking the mouse and the input mark is displayed, it seems that the transparent layer is covered. But sometimes it is normal, it can be described as intermittent mental disorder. Some machines have a 50% probability, and some machines have a 30% probability.

You have to perform some tests and analysis.

I tested IE6 on the Virtual Machine and found that, as said by the test team.

I'm sure there can be no extra overlay, because in addition to text boxes, any text around it can be normally selected with the mouse, and any elements around it, including the text box itself, can also respond to the onclick event, however, no matter how you click it, you cannot obtain the input focus. (ReadOnly or disabled is not set in the text box)

However, some small actions can restore them to normal. For example, right-click the Iframe and refresh it, or press the 'tab 'key in the Iframe to switch the focus to any text box, all text boxes can be clicked to get the focus. It's really abnormal!

We can't say this is an IE6 BUG that our program cannot solve. The leaders won't listen to this.

After some efforts, we still have a solution.

I found that manually calling the focus () method of any (usually the first) text box can restore all the text boxes. Therefore, I wrote a public script to get the first text box and call its focus () at the end of the page in Iframe. After a hundred times of tests, I did not encounter any problem where I could not get the focus, solve the problem.

The following is a reply from a user:
Which label is displayed?
It seems okay to change to the <span/> label.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.