81,092
社区成员
发帖
与我相关
我的任务
分享
parent.frames["frameName"].window.functionName();
frameName:IFrame的ID;
funtionName:子页面中JS方法名;
如果实在是不行的话,我也没有办法了,反正 就是这个思路,就是要看具体的实现了。
有可能是浏览器不兼容的问题,获取其他的什么问题导致访问不了 //给iframe页面加载完后给iframe中的按钮绑定点击事件()
$("#myIframeId").on("load", function(event){
$("#rz",this.contentDocument).click(function(){
alert("你倒是给点反应啊....");
myIframeName.window.asd();//调用子页面asd();
});
});
这是iframe
<div style="display:none;" id="showIframe">
<iframe name="myIframeName" id="myIframeId" width="100%" height="100%" frameborder="0"></iframe>
</div>
$("#aa").click(function(){
$("#showIframe").show();//显示iframe子页面
alert($("#bicycleTable").serialize());//序列化父页面表单
//打印拿到的iframe页面数据
alert($(window.frames["myIframe"].document).find("input:radio").attr("checked","true"));
});
,
这是父页面内容
<body>
<table width="100%" border="0" cellpadding="0" cellspacing="0" >
<tr>
<td id="aa">
<a href="stationSelect.jsp" target="a">
<input type="button" value="入桩"/>
</a>
</td>
</tr>
</table>
<div style="display:none;" id="showIframe">
<iframe name="a" id="myIframe" width="100%" height="100%" frameborder="0"></iframe>
</div>
$(window.frames["myIframe"].document).find("#子页面的提交按钮ID/页面关闭按钮的ID").onclick = function(){
//在这里面打印你要获取的数据
}
$("formID").serialize();
这个就是获取表单id为formID的表单域值,他们分别是以&分割的,是以key=value的形式的