2017-11-15 9 views
1

モデル内にiframeがあります。 iframeはウェブサイトeg.xxxを開きます。 xxx.comから、私はeg.xxx/yyy.htmlに引き継がれたボタンのクリックに複数のボタンがあります。ダイアログボックスを閉じると、xxx.comではなくxxx/yyy.htmlが表示されます。 この問題はJavascriptでどうやって解決できますか? モーダル内のiframeのsrcをリフレッシュする方法

セクションモーダルコード:

<!-- Start Feature Section --> 
<div class="section-modal modal fade" id="magazine-modal" tabindex="-1" role="dialog" aria-hidden="true"> 
    <div class="modal-content"> 
     <div class="close-modal " data-dismiss="modal"> 
      <a href="../twt/index.html" style="color: #000000; font-size: 30px;" data-toggle="modal"> 
       <i class="fa fa-home"></i> 
      </a> 
      <!-- <div class="lr"> 
       <div class="rl"> 
       </div> 
      </div>--> 
     </div> 
     <div class="container "> 
      <div class="row"> 
       <div class="section-title text-center"> 
       </div> 
      </div> 
      <div class="row modal-body"> 
       <iframe src="https://www.pvrcinemas.com/magazines" target="_self" style="position:fixed; top:65px; left:0px; bottom:0px; right:0px; width:100%; height:95%;color:#000000; border:none; margin:0; padding:0; overflow:hidden; z-index:999999;"> 
        Your browser doesn't support iframes 
       </iframe> 
      </div> 
     </div> 
    </div> 
</div> 
<!-- End Feature Section --> 

同じで私を助けてください。

+1

https://stackoverflow.com/questions/46289527/change-default-iframe-src-onclick-and-retain-src-after-page-refresh/46290093#46290093さわやかSCR属性に部分的に類似しましたjavascriptを介して行われます。 iframeにIDを追加すると、そのフレームをターゲットにするのがずっと簡単になります。ポストリンクはまた、localstorageを介して行われた選択を記憶に残しています...多分それはあなたの次の質問でしたか? –

答えて

0

モーダルショーを呼び出す前に。 iframe srcに必要なURLを設定するだけです。

$('#magazine-modal').find("iframe").attr("src","https://www.pvrcinemas.com/magazines"); 
$('#magazine-modal').modal('show'); 
関連する問題