Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用jquery在iframe内选择表td值_Jquery_Wordpress_Iframe_Html Table - Fatal编程技术网

使用jquery在iframe内选择表td值

使用jquery在iframe内选择表td值,jquery,wordpress,iframe,html-table,Jquery,Wordpress,Iframe,Html Table,我试着这样做了一个小时。我到处都能找到梅的建议,但都不管用 <button id="dugme" type="button">Click Me!</button> <iframe id="frm" src="http://www.kursna-lista.info/resources/kursna-lista.php?format=3&datum=1" width="260px" height="130px" frameborder="0" scroll

我试着这样做了一个小时。我到处都能找到梅的建议,但都不管用

 <button id="dugme" type="button">Click Me!</button>

<iframe id="frm" src="http://www.kursna-lista.info/resources/kursna-lista.php?format=3&datum=1" width="260px" height="130px" frameborder="0" scrolling="no"></iframe>
}))


有人能帮我吗?据我所知,你不能这么做。基本上,在iframe中,您访问的是另一个应用程序中的另一个URL。浏览器作为一种安全策略,不允许您访问来自不同域的对象。无法读取跨站点内容-XSS保护。

现代浏览器将此视为跨站点脚本有很好的理由,您将不会有运气

想象你在一个作者的页面上,在一个看不见的iframe中,作者在亚马逊上为你买了20本书。只需单击jscript,因为您已在另一个选项卡上登录到amazon

jQuery(document).ready(function($) {
var target_document = $('#frm')[0].contentWindow.document;
var target_result   = $(target_document).find('table');
$('#dugme').on('click', function() {
alert(target_result.html());
});