php 保存 Iframe 内容时出错
var htmll = $("#iframe1").html();
alert(htmll);
$("#myTextarea")
.val(htmll)
.parents("form")
.submit();
我正在得到
警报(html1);
作为空白。 iframe在HTML中的位置是
<body>
<iframe id="iframe1" src="load.php?sinput=<?php echo $_GET['sinput'] ?>" > </iframe>
</body>
var htmll = $("#iframe1").html();
alert(htmll);
$("#myTextarea")
.val(htmll)
.parents("form")
.submit();
I am getting the
alert(html1);
as blank.
The location of iframe in the HTML is
<body>
<iframe id="iframe1" src="load.php?sinput=<?php echo $_GET['sinput'] ?>" > </iframe>
</body>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不知道你的 JQuery 代码,但我知道你可以执行类似
document.getElementById("iframe1").contentDocument.body.innerHTML 的
操作,但是,如果这与你执行此操作的页面不在同一域中,那么你就会得到一个安全例外。
如果你想筛选抓取的内容,你就必须比这更聪明。另外,这实际上不是一个 PHP 问题。
I dunno about your JQuery code, but I know you could do something like
document.getElementById("iframe1").contentDocument.body.innerHTML
BUT, if this isn't in the same domain as the page you're executing this from, then you're going to get a security exception.
If you're trying to screen scrape, you're going to have to be more clever than that. Also, this isn't actually a PHP question.