How to dynamic load the document content into an iframe?

后端 未结 2 862
南笙
南笙 2021-01-14 05:46

I would like to make something like this

|--------------------------|
|                A         |
|        ____________      |
|       |            |     |
         


        
相关标签:
2条回答
  • 2021-01-14 06:34

    You may want to look at an AJAX solution. This way you avoid the iframe and associated complexity. On the A page you can create a div tag with a specific id. Then using AJAX you can load the content of the B page into the div tag.

    The HTML that is loaded can then directly be manipulated by the code on your A page since it is essentially one page.

    If you are using plain javascript then you will find all the info you need in this tutorial.

    If on the other hand you wish to use jQuery then it is as simple as:

      $('#myDiv').load('B.html');
    

    where myDiv is the ID of your div.

    0 讨论(0)
  • 2021-01-14 06:45
    $('#iframeId').contents().find('html').html(yourContent);
    
    0 讨论(0)
提交回复
热议问题