1. the parent page click the first button trigger, get the body element sub-page, call the js method defined in sub-pages
Yes: function (index, layero) { // Get iframe body element var body = layer.getChildFrame ( 'body' , index); // get page iframe window object var iframeWin = window [layero.find ( 'iframe' ) [0] [ 'name' ]]; // showMsg method performed iframe page iframeWin.showMsg ( "Mercy" ); the console.log (iframeWin); the console.log ( "Yes callback:" + body.html ()); the console.log (layero, index); }
2. subpages defined showMsg () method:
<script type="text/javascript"> function showMsg(msg){ layer.msg(msg); } </script>