Html 如何在单击链接时从同一源加载两个iFrame?
我正试图用Zoho Creator提供的iFrame在我的网站上显示服务的价格表。 我遇到的问题是,有一项服务的某些产品具有可用价格,而某些产品具有按需定价 这是两个不同的iFrame,单击该服务链接时应显示这两个iFrame。由于iFrame只能接受一个src属性,如何通过单击同一链接加载其中两个 到目前为止,我已经创建了按钮链接,其中每个链接都指定了唯一的类,如Html 如何在单击链接时从同一源加载两个iFrame?,html,jquery,iframe,Html,Jquery,Iframe,我正试图用Zoho Creator提供的iFrame在我的网站上显示服务的价格表。 我遇到的问题是,有一项服务的某些产品具有可用价格,而某些产品具有按需定价 这是两个不同的iFrame,单击该服务链接时应显示这两个iFrame。由于iFrame只能接受一个src属性,如何通过单击同一链接加载其中两个 到目前为止,我已经创建了按钮链接,其中每个链接都指定了唯一的类,如 <a class="button radiology button_size_2 button_js"
<a class="button radiology button_size_2 button_js" href="#radiologija"><span class="button_label">Radiology</span></a>
试试这个
$(函数(){
$('.changeframe')。单击(函数(){
$('declinedframe').attr('src','https://creator.zohopublic.com/example2');
});
$(“#radiologija”)。单击(函数(){
$('declinedframe').attr('src','https://creator.zohopublic.com/example2');
if($(“#容器”).find(“iframe”).length==1){
常量if2=$('',{“id”:“if2”});
$('#declinedframe').next().after(if2);
}
$('if2').attr('src','https://creator.zohopublic.com/example3');
});
})
您认为这将如何工作?您有一个iFrame,然后可以显示一个页面。如果您将iframe的URL发送到服务器,您可能能够合并结果并在一个位置显示,这甚至不必是一个iframe您必须使用两个iframe
@mplungjan我想象它的工作方式是,当单击一个链接时,两个iframe会在另一个链接下打开一个。
<iframe id="declinedframe" class="embed-responsive-item" src="https://creator.zohopublic.com/example1" width="100%" height="585"></iframe>
(function($) {
$('.changeframe').click(function () {
$('#declinedframe').attr('src', 'https://creator.zohopublic.com/example2');
});
$('.radiology').click(function () {
$('#declinedframe').attr('src', 'https://creator.zohopublic.com/example3'); // for radiology I need to load two iframes
});
})( jQuery );