1.iframe中jsp写法
<input type="button" value="aaaa" onclick="test123();" />
<script type="text/javascript">
function test123(){
alert('iframe页面');
var js= document.createElement("script");
js.type="text/javascript";
js.src = "http://ip1:port1/uias/uias/login/login1.js";
document.getElementsByTagName("head")[0].appendChild(js);
}
2.父类中写法
<iframe id="pframe" style="width:800px; height:200px; border: 1px solid red;"
src="http://ip2:port2/uiasmag/uias21/uiasLogin/loginMagPassword.jsp"></iframe>
</div>
3.父类login1.js
alert('iframe父页面方法');
本文介绍了一种在iframe中使用JavaScript进行页面间通信的方法。通过在子页面中动态加载外部JS文件,实现了与父页面的交互。具体包括iframe内按钮触发事件、加载指定JS文件及父页面响应。
983

被折叠的 条评论
为什么被折叠?



