Analysis on IE10 compatibility (cols attribute of frameset) _ javascript tips-js tutorial

Source: Internet
Author: User
The home page uses frameset to embed two pages. The left side is the menu bar. You can change the cols of frameset to shrink the page. Other browsers are normal, but IE10 does not respond to any recent requirements that involve browser compatibility. The first thing to deal with is ie10.

The home page uses frameset to embed two pages. The left side is the menu bar. You can change the cols of frameset to shrink the page. Other browsers are normal, but IE10 does not respond.

The Code is as follows:


Function hide_show (){
If (window. parent. outer_frame.cols = "0, 10 ,*"){
Frameshow. src = "<% = request. getContextPath () %>/common/images/left_handle.gif ";
P_hide_show.title = "hide"
Window. parent. outer_frame.cols = "210,10 ,*";
} Else {
Frameshow. src = "<% = request. getContextPath () %>/common/images/right_handle.gif ";
P_hide_show.title = "show"
Window. parent. outer_frame.cols = "0, 10 ,*";
}
}


Setting cols has no effect. You can set rows. This is because of the IE10 BUG. You need to adjust the page size to take effect:

The Code is as follows:


Function hide_show (){
If (window. parent. outer_frame.cols = "0, 10 ,*"){
Frameshow. src = "<% = request. getContextPath () %>/common/images/left_handle.gif ";
P_hide_show.title = "hide"
Window. parent. outer_frame.cols = "210,10 ,*";
} Else {
Frameshow. src = "<% = request. getContextPath () %>/common/images/right_handle.gif ";
P_hide_show.title = "show"
Window. parent. outer_frame.cols = "0, 10 ,*";
}

/* Force ie10 redraw */
If (navigator. userAgent. indexOf ('msie 10.0 ')! =-1 ){
Var w = parent.doc ument. body. clientWidth;
Parent.doc ument. body. style. width = w + 1 + 'px ';
SetTimeout (function (){
Parent.doc ument. body. style. width = w-1 + 'px ';
Parent.doc ument. body. style. width = 'auto ';
}, 0 );
}
}

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.