IE 6下iFrameページネストhtml空白問題解決
1306 ワード
IE 6でiframeでページをネストする:
ネストされたページに次のcssがある場合:
次の問題が発生します.
ネストされたページは先にロードされ、空白になります.
理由:
ネストされたhtmlはシベリアに位置づけられた.
解決策:
ネストされたhtmlのロードが完了したらiframeのposition属性値をrelativeに変更します.
例1:
iframeページ:
ネストされたページ:
解決策:
iframeに直接プロパティを追加:style=「position:relative;」
例2:
iframeページ:
ネストされたページ:
解決策:
iframeに次のプロパティを追加します.
次のようになります.
次に、次の方法を追加します.
これでいいです.
<iframe src="http://externaldomain.com/something.html">
ネストされたページに次のcssがある場合:
html { position: relative; }
次の問題が発生します.
ネストされたページは先にロードされ、空白になります.
理由:
ネストされたhtmlはシベリアに位置づけられた.
解決策:
ネストされたhtmlのロードが完了したらiframeのposition属性値をrelativeに変更します.
例1:
iframeページ:
<iframe src="http://externaldomain.com/something.html">
ネストされたページ:
html { position: relative; }
解決策:
iframeに直接プロパティを追加:style=「position:relative;」
例2:
iframeページ:
<iframe src="http://externaldomain.com/something.html">
ネストされたページ:
document.getElementsByTagName('HTML')[0].style.position = 'relative';
解決策:
iframeに次のプロパティを追加します.
onload=changePosition(this);
次のようになります.
<iframe src="http://externaldomain.com/something.html" onload=changePosition(this);>
次に、次の方法を追加します.
function changePosition(obj){
obj.style.position='relative';
}
これでいいです.