首頁  >  文章  >  web前端  >  淺析IE10相容性問題(frameset的cols屬性)_javascript技巧

淺析IE10相容性問題(frameset的cols屬性)_javascript技巧

WBOY
WBOY原創
2016-05-16 17:05:311195瀏覽

最近需求涉及瀏覽器的相容性,首先處理的是ie10。

首頁用 frameset 嵌入了兩個頁面,左側為選單欄,可以透過改變 frameset 的 cols 來縮小。別的瀏覽器正常,但 IE10 卻沒任何的反應。

複製程式碼 程式碼如下:

function hide_show(){
if(window. parent.outer_frame.cols=="0,10,*"){
frameshow.src="/common/images/left_handle.gif";
div_hide_show.titletle ="隱藏"
window.parent.outer_frame.cols = "210,10,*";
}else{
frameshow.src="/common/ images/right_handle.gif";
div_hide_show.title="顯示"
window.parent.outer_frame.cols = "0,10,*";
}
}


設定cols無效果,設定rows可以,這個是由於IE10的BUG問題,需要調整頁大小才會生效: 程式碼如下:


function hide_show(){
if(window.parent.outer_frame.cols=="0,10,*"){
frameshow.src ="/common/images/left_handle.gif";
div_hide_show.title="隱藏"
window.parent.outer_frame.cols = "210,10,*" ;
}else{
frameshow.src="/common/images/right_handle.gif";
div_hide_show.title="顯示"
window. parent.outer_frame.cols = "0,10,*";}


/*force ie10 redraw*/
if(navigator.userAgent.indexOf('MSIE 10.0') != -1){
var w = parent.document.body.clientWidthth;
parent .document.body.style.width = w 1 'px';
setTimeout(function(){
parent.document.body.style.width = w - 1 'px';
parent.document .body.style.width = 'auto';
}, 0);
}
}

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn