js cross-domain call parent class method

 

1. Jsp writing in iframe


<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. Writing in the parent class

<iframe id="pframe" style="width:800px; height:200px; border: 1px solid red;"
src="http://ip2:port2/uiasmag/uias21/uiasLogin/loginMagPassword.jsp"></iframe>
</div>

 

3. Parent class login1.js

alert('iframe parent page method');

 

 

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326349436&siteId=291194637