简体   繁体   English

iframe中的表单按钮,单击后在父窗口中加载

[英]Form Button in Iframe, When Clicked, Load in Parent Window

My page has an iFrame that loads products from an external javascript file. 我的页面上有一个iFrame,可以从外部javascript文件加载产品。 The products are not links, they are submit input buttons. 产品不是链接,它们是提交输入按钮。 Without knowing the url of the button, is it possible to load in the parent window instead of the iframe when clicked? 如果不知道按钮的网址,是否可以在单击时加载到父窗口中而不是iframe中?

Please note, I do not have access to change anything within the javascript inside the iframe. 请注意,我无权更改iframe中javascript中的任何内容。

<iframe>
    <!-- irrelevant code -->

    <!-- button generated by external javascript -->
    <input class="ssc_lrBuyBtn" onclick="ssc.buyClicked(1,2)" id="ssc_BB_1" value="Buy" type="button">

</iframe>

There are no form tags around each of the buttons. 每个按钮周围没有表单标签。 The urls that the buttons call change regularly. 按钮调用的网址会定期更改。 Could I add javascript before or after the iframe to make the buttons open in the parent window? 我可以在iframe之前或之后添加javascript,以在父窗口中打开按钮吗? As of now, I have tried the base tag and a js snippet that is supposed to change the target, however, I think they only work for links, not buttons. 到目前为止,我已经尝试了基本标记和应该更改目标的js代码段,但是,我认为它们仅适用于链接,而不适用于按钮。

Any help is greatly appreciated! 任何帮助是极大的赞赏!

onsubmit="window.opener.location.reload();"

might help. 可能有帮助。 Check out this thread: Refresh Parent Window with JS 签出此线程: 使用JS刷新父窗口

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用iframe中的按钮重新加载父窗口 - Reloading parent window with a button in the iframe 单击按钮并重定向到父窗口时显示状态弹出窗口-SpringBoot - Display a status popup when a button is clicked and redirect to the parent window - SpringBoot 单击按钮后,在iframe(父项:php,子项:aspx)中关闭iframe - Close iframe within iframe (parent:php, child:aspx) when a button is clicked AngularJS-在父视图中单击“保存”按钮时验证指令中的表单 - AngularJS - Validation for a form in a directive when 'save' button is clicked in the parent view 我可以在iFrame中加载域吗?单击链接后,该域会在父窗口中打开,而不是在iframe中打开吗? - Can I load a domain in my iFrame and when you click a link, it opens in the parent window, not the iframe? 单击Iframe中的链接时,使用历史记录pushState更改父窗口的URL - Change a parent window's URL using history pushState when link in Iframe is clicked Javascript-iframe是否加载所有父窗口脚本? - Javascript - Iframe load all parent window scripts? 将href加载到iframe,但将其定位在父窗口中 - load href to iframe but targetting it in parent window iframe父窗口的Javascript后退按钮 - Javascript back button for iframe parent window 在iframe按钮上单击关闭父窗口 - Close parent window on iframe button click
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM