如何在我的页面中调用Iframe JavaScript函数
How to call Iframe JavaScript function inside my page
我的页面旁边有Iframe,在下面的javascript中。
function getTotSeats(){
window.WebAppInterface.showToast(document.forms[0].txtSeat_no.value);
return document.forms[0].txtSeat_no.value;
}
我想在我的页面中调用上面的javascipt函数。
我的页面是
<iframe name="select_frame" sandbox="allow-same-origin allow-scripts allow-popups allow-forms" id="iframe_id" src="http://202.65.147.152:8080/tgtdc/etg/seatLayoutReservation.jsp?upDown=UP&toCityCode=100&serviceCode=34&totSeats=2&vehicle=HITECH%20-%20AC&toDate=31-08-2015&FR=F" width=100% style="z-index:10000" height="480" frameborder="0" scrolling="no" style="border:none;"></iframe>
<input type='button' name='save' value='SAVE' id="save_id" style="height:30px;width:100px;">
<script>
$('#save_id').click(function() {
var el = document.getElementById('iframe_id');
var result=getIframeWindow(el).getTotSeats();
alert(result);
});
但是我在页面中没有得到iframe函数值。我如何获得该值。你能请任何人帮我吗?
由于同源策略,您无法执行此操作。您可以使用postMessage查看跨窗口消息。
http://javascript.info/tutorial/cross-window-messaging-with-postmessage
相关文章:
- 在单击一个或多个复选框的同时调用iframe
- 从父页面调用iframe中的javascript,IE问题
- 如何在我的页面中调用Iframe JavaScript函数
- 从父窗口调用iframe函数
- 从另一个窗口调用 iframe
- 如何javascript调用iframe加载的文件函数
- 从window.opener调用iframe中的javascript函数
- 从父窗口调用Iframe中的函数
- 如何从代码背后调用IFrame中的JS函数
- 为什么当我试图从父页面调用iFrame中的函数时,我得到一个TypeError
- 需要iFrame外部的父按钮来调用iFrame内部加载的JS函数
- 如何调用iframe来做某事
- 如何防止反广告拦截脚本改变'src'属性异步地调用iframe元素
- 即使没有通过单击链接调用iframe,也会加载Java类.为什么
- 如何从父页面调用iframe中的脚本
- 从父窗口调用iframe中的函数
- Safari没有'当src不是有效的站点时,不要调用iframe-onload
- 调用iframe内部的函数
- 如何使用JS调用iframe中的函数
- 在js函数内部调用iframe