在父页面和其iframe之间函数回调 父页面回调iframe里写的函数

// @shaoyang  父页面
window['mengBanLogin']={
mengBanArr : new Array(),
mengBanLoginSuccess : function(){
console.log('mengbanzhixing');
if(mengBanLogin.mengBanArr.length > 0){
for(var i = mengBanLogin.mengBanArr.length-1; i >= 0; i--){
mengBanLogin.mengBanArr[i]();
}

}
}
}
jQuery("#mengban").click(function(){
//if(!QQ.Cookie.get("skey")){
if(QQ.Cookie.get("uin")==null){
userLogin();
window['login'].cbArr.push(mengBanLoginSuccess);
}else{
mengBanLoginSuccess();
}
function mengBanLoginSuccess(){
window['mengBanLogin'].mengBanLoginSuccess();
jQuery(this).hide();
jQuery("#videobox").show();
addCName(0);
video.setVid(firstVid);
jQuery("#shipinTitle li").eq(vnum-1).addClass("on").siblings().removeClass("on");
}
});

//iframe里的

//以下实现的功能是 视频播放器上有蒙板的页面
if(typeof(parent['mengBanLogin'])!='undefined'){
parent['mengBanLogin'].mengBanArr.push(mengBanLoginSuccess);
}
function mengBanLoginSuccess(){
player.play();
console.log('loghha');
}

原文地址:https://www.cnblogs.com/mabelstyle/p/3796260.html