IE6 pop-up iframe layer text box "Often" cannot get input focus _javascript tips

Source: Internet
Author: User

Company Web project requirements are compatible with FF3,IE6/7/8. A bug under IE6 is described in this article.

The project has written a package of their own pop-up layer, the principle is to dynamically add a mask layer, and then dynamically add a div (Table) layer (Do the pop-up layer PNG translucent border effect), the div dynamic add an iframe, this iframe page points to an existing HTM file.

If the HTM file contains some form elements such as a text input box, it will be Lou Zi under IE6.

The test group said that when the pop-up layer is open, "often" cannot get the focus of the text box, that is, the mouse-point text box does not get the focus and displays the input tag as if it were covered by a transparent layer. But sometimes it's normal, it's intermittent mental disorder. Some machines on the chance of 50%, some of the machine on the probability of about 30% appear.

There must be a test and analysis.

After I tested the virtual machine IE6, I also found that it was true, as the people in the test group said.

I'm sure there's no extra overlay because except for the text box, any text around it can be selected correctly with the mouse, and any element around it, including the text box itself, can respond to the onclick event, but no matter how, you can't get the input focus. (text box is not set readonly or disabled)

However, some of the gestures can make them back to normal, such as in the IFrame right button refresh, or in this iframe press the ' TAB ' key to switch focus to any text box, then all the text boxes can be clicked to get the focus of normal. It's sick!

We can not say this is IE6 bug we can not solve the program, the leader does not listen to this word.

After some effort, there is still a solution.

I found that a manual call to the focus () method of any (usually first) text box would allow all text boxes to regain their sanity. So write a public script, in the IFRAME at the end of the page, get the first text box and call its focus (), the measured Belaize, and then did not meet the lack of access to the situation, solve the problem.

Below is the Netizen reply:
The pop-up tag is <a/> tag, right?
Change to <span/> label seems to be OK.

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.