2017-06-20 6 views
0

リンクをクリックするたびにiframeにそれぞれのページが表示されるように、次のコードを実行しようとしています。 iframesをオーバーレイしようとしていますが、コードが期待どおりに動作していないようです。HTMLを使用して同じ幅と高さの別のiframeにiframeを配置する方法

<iframe name="IFrame1" style="width: 200px; height: 200px; display: block;position: relative;" src="https://www.link1.com"></iframe> 
 

 
<iframe name="IFrame2" style="width: 200px; height: 200px; top: 10px;left: 10px;display:block;position: absolute;" src="http://www.link2.com"></iframe> 
 

 

 
<p><a href="https://www.link1.com" target="IFrame1">link1</a></p> 
 
<p><a href="http://www.link2.com" target="IFrame2">link2</a></p>

親切に私はそれを乗り越えるのに役立ちます。

答えて

0

シングルiframeのみを使用できます。一般に

<iframe name="IFrame1" style="width: 200px; height: 200px; display: block; 
 
position: relative;" src="https://www.link1.com"> 
 
</iframe> 
 

 

 
<p><a href="https://www.link1.com" target="IFrame1">link1</a></p> 
 
<p><a href="http://example.com/" target="IFrame1">link2</a></p>

+0

の上に配置しているために問題にはなりませんIFrame1 "style =" width:200px; height:200px; display:block; position:relative; " SRC = "https://www.w3schools.com"> ​​

link1

link2

+0

私はこれを試してみましたが、第2のリンクが開かれていません。 –

+0

リンクが有効であることを確認してください。 –

0

iframe { 
 
    width:200px; 
 
    height:200px; 
 
    position:absolute; 
 
    border:solid 1px #000; 
 
} 
 

 

 
#front { 
 
    position:absolute; 
 
    border:solid 1px #000; 
 
    width:100px; 
 
    height:100px; 
 
    left:120px; 
 
    top:120px; 
 
    background:#f00; 
 
    box-shadow:0 0 10px #666; 
 
    
 
}
<iframe src="https://www.link1.com"></iframe> 
 
<div id="front"> 
 
<iframe src="https://www.link1.com"></iframe></div>

は、DIVは、

関連する問題