0

在我的应用程序中,一些 .aspx 页面由 window.showModalDialog 调用,如下所示

window.showModalDialog('../SelectUser.aspx?',window,sFeatures);

其中 sFeatures 声明如下

sFeatures = "dialogWidth=400px;dialogHeight=450px;border=thick;center=yes;help=no;status=no;title=Task";

在通过 ShowModalDialog 清除页面的所有页面中,默认情况下禁用复制粘贴选项。如何从 showModalDialog 页面启用复制粘贴选项。

4

2 回答 2

0

showModalDialog不允许您在使用 ShowModalDialog 打开对话框的窗口和实际对话框本身之间复制和粘贴信息。为此,您需要改为打开页面window.open

有关这方面的更多信息,请参阅“需要 ModalDialog 帮助”“showModalDialog”

于 2013-04-15T17:58:33.943 回答
0

引用MSDN上的 showModalDialog 文档

模态和非模态 HTML 对话框都不支持文本选择或用于复制操作的标准快捷菜单;但是,您可以通过使用带有 TextRange 对象的脚本和 onmousedown 和 onmousemove 的事件处理程序来模仿此功能,如下例所示。

代码示例:http ://samples.msdn.microsoft.com/workshop/samples/author/dhtml/refs/showModalDialogLaunch.htm

作为替代方案,您可以实现自己的模式对话框

var dlg = window.open(url, '_blank', 'modal=yes,dialog=yes');

var winFocus = window.onfocus;

window.onfocus = function() {
    if (dlg /* && possible additional condition based on dialog flow */) {
        dlg.focus();
    } else {
        window.onfocus = winFocus;
        // callback for dialog closing
    }
}
于 2015-12-18T09:46:35.663 回答