js跨域调用父类方法

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父页面方法');

猜你喜欢

转载自chun521521.iteye.com/blog/2404026