gpt4 book ai didi

javascript -
内容未加载到 <iframe> 中

转载 作者:行者123 更新时间:2023-11-29 18:17:08 26 4
gpt4 key购买 nike

HTML:

<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0" />
<link href="css/jquery.mobile-1.4.1.min.css" rel="stylesheet">
<script src="js/jquery-1.11.0.min.js"></script>
<script src="js/jquery.mobile-1.4.1.min.js"></script>
<script src="js/index.js"></script>

</head>
<body>
<div data-role="page" id="demo-page" data-url="demo-page">
<iframe id="iframe1" src="" width="100%" height="300">
</iframe>
<div role="main" class="ui-content" id="div-content">
<h1>Panel responsive</h1>
<p>This is a typical page that has two buttons in the header bar that open panels. The left panel has the push display mode, the right panel reveal. To make this responsive, you can make the page re-flow at wider widths. This allows both the panel menu and page to be used together when more space is available. This behavior is controlled by CSS media queries.</p>
</div>
</div>
</body>
</html>

JS

<script>
$(document).ready(function(){
$("#iframe1").attr('src','#div-content');
});
</script>

Here my Jsfiddle Example

我的问题是我只想加载 <div> <iframe>中的内容.但就我而言,当我加载 <div><iframe>中的内容然后在 <iframe> 中加载额外的内容.

如果有人对这个问题有任何想法,请帮助我。

最佳答案

试试这个:

$('#iframe1').contents().find('html').html($('#div-content').html());

$('#iframe1').contents().find('body').html($('#div-content').html());

关于javascript - <div> 内容未加载到 &lt;iframe&gt; 中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22190791/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com