我的主页里面有一个iframe.iframe页面中有一个modalpopup.因此,当显示modalpopup时,modalpopup的父级是iframe主体和主页面父主体.因此,叠加层仅覆盖iframe而不是整个页面.
我尝试使用jQuery将modalpopup从iframe移动到父窗口body元素(或父窗体内的任何其他元素).我收到一个无效的参数错误.
如何从iframe中的页面显示modalpopup,它应该覆盖整个文档,父文档?
更新:
由于很少有用户对实现相同的行为感兴趣.这里是解决方法
我建议的最好的解决方法是在主页面中使用modalpopup ..然后从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 }
希望能帮助到你