IE6-IE9 compatibility problem list and solution 5: In ie9, after the disabled text box content is selected, other controls cannot get focus problem

Source: Internet
Author: User

First look at an htmCodeIt contains a disabled text box, a common writeable text box, and a button. The Code is as follows:

<! Doctype HTML public "-// W3C // dtd xhtml 1.0 transitional // en" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<HTML xmlns = "http://www.w3.org/1999/xhtml">
<Head>
<Title> </title>
</Head>
<Body>
Disabled input: <input type = "text" id = "B1" value = "asldfjasldfa" Disabled = "disabled"> </input> <br/>
Non-disabled input: <input type = "text" id = "B2" value = "asldfjasldfa"> </input>
<Input type = "button" id = "butt1" name = "butt" value = "close" onclick = "window. Close ()"/>
</Body>
</Html>

The running page is as follows:

The actual test shows that, in ie9, once the mouse enters the disabled text box, for example, dragging the mouse inside and selecting some content, and then trying to move the mouse away, for example, moving it to the second text box, for example, if you click the close button below, you will find that you cannot do it. It seems that the focus of the disabled text box can never be left, and other text boxes or buttons will never get the focus unless you use the tab key to switch, or simply switch to another software interface and then turn back, then other controls can be clicked.

 

This problem was not found in IE6, 7, 8, and 10.

 

After consultation, I learned that this is indeed a bug in ie9.

 

How can this problem be solved? Below are some of the methods we have explored:

1. Upgrade to ie10.

The upgrade to ie10 naturally solves this problem. Since ie10 has solved this problem, ie9 should not fix this bug with patches.Program.

2. Double-click the other part of the page to remove the focus from the disabled text box.

3. writing a script to disable disabled text box selection is also a method, but the premise is that since the text box has been disabled, it will not accept any JS events, so this action can only be performed on its parent element, for example, bind a JS event to another plug-in outside the disabled text box to prohibit the mouse from entering or selecting this area, the disabled text box cannot be selected, so the problem that the focus of the text box cannot be left does not exist.

 
I wonder if you have encountered this problem and have any better solutions?

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.