我的主页里面有一个iframe iframe页面中有一个模式。所以当显示modalpopup时,modalpopup的父项是iframe主体和主页父体。因此,覆盖只覆盖了iframe而不是整个页面。
我尝试使用jQuery将modalpopup从iframe移动到父窗体body元素(或父体内的任何其他元素)。我得到一个无效的参数错误。
如何从iframe中的页面显示一个模式,并且它应该覆盖整个文档,父文档?
更新:
我建议的最好的解决方法是在主页面中添加模态文件,然后从iframe中调用它。说这样的东西..
/* function in the main(parent) page */ var _onMyModalPopupHide = null; function pageLoad(){ // would be called by ScriptManager when page loads // add the callback that will be called when the modalpopup is closed $find('MyModalPopupBehaviorID').add_hidden(onMyModalPopupHide); } // will be invoked from the iframe to show the popup function ShowMyModalPopup(callback) { _onMyModalPopupHide = callback; $find('MyModalPopupBehaviorID').show(); } /* this function would be called when the modal popup is closed */ function onMyModalPopupHide(){ if (typeof(_onMyModalPopupHide) === "function") { // fire the callback function _onMyModalPopupHide.call(this); } } /* functions in the page loaded in the iframe */ function ShowPopup(){ if(typeof(window.parent.ShowMyModalPopup) === "function") { window.parent.ShowMyModalPopup.apply(this,[OnPopupClosed]); } } // will be invoked from the parent page .. after the popup is closed function OnPopupClosed(){ // do something after the modal popup is closed }
希望它有帮助