我有一个右键单击方法
this.rClickFunction = function ( e )
{
//at the moment it just creates a div
r = e.currentTarget.createElement( 'div' );
r.setAttribute( 'id', 'Rmenu' );
r.innerHTML = "sdgfsdgfsdgfsdgfsdgfsdgfsdf";
e.currentTarget.body.appendChild( r );
}
这是在两个地方召集的。 1)主窗口 2)使用window.open
从主窗口创建的窗口当我右键单击主窗口时使用
$( window.document ).bind( "contextmenu", this.rClickFunction )
它工作正常。但是当从衍生的窗口尝试(也在相同的庄园中绑定上下文菜单)时它无法工作。创建窗口后,我可以右键单击该窗口,并运行上面相同的代码。它似乎运行代码来创建一个div但它没有显示在窗口上。如果我运行我的调试工具来检查页面,它显然不存在。奇怪的是,如果我这样做
alert( e.currentTarget.getElementById( 'Rmenu' ).ownerDocument.title );
当我生成一个新窗口时,我使用
var strWindowFeatures = "menubar=no,location=no,resizable=no,scrollbars=no,status=yes,width=500,height=400";
newWindow = window.open( "about:blank", "", strWindowFeatures, false );
我想知道是否:空白被视为跨域?
它显示弹出窗口的标题。所以它肯定在某处。这是从调试检查窗口工具
查看的衍生窗口<html>
<head></head>
<body>
<div id="-1" class="boxFlat_msBlue" data-minwidth="75" data-minheight="50" style="z-index: 101; width: 1093px; height: 92px; top: 0px; left: 0px;"></div>
</body>
<link rel="stylesheet" href="/SCT/igniteui/Demos/content/style.css"></link>
<link rel="stylesheet" href="/SCT/SCT_JQAPI/css/infobox.css"></link>
<link rel="stylesheet" href="/SCT/SCT_JQAPI/css/main.css"></link>
<link rel="stylesheet" href="/SCT/SCT_JQAPI/css/menu.css"></link>
<link rel="stylesheet" href="/SCT/SCT_JQAPI/css/otherelements.css"></link>
<link rel="stylesheet" href="/SCT/SCT_JQAPI/css/shortcutbar.css"></link>
<link rel="stylesheet" href="/SCT/SCT_JQAPI/css/tooltip.css"></link>
<link rel="stylesheet" href="/SCT/SCT_JQAPI/css/tree.css"></link>
<link rel="stylesheet" href="/SCT/SCT_JQAPI/css/window.css"></link>
<link rel="stylesheet" href="/SCT/SCT_JQAPI/css/window_originaladvantage.css"></link>
<link rel="stylesheet" href="/SCT/plug-ins/jquery.contextMenu.css"></link>
<link type="text/css" rel="stylesheet" href="../../SCT/igniteui/css/themes/infragistics/infragistics.theme.css" media="screen"></link>
<link type="text/css" rel="stylesheet" href="../../SCT/igniteui/css/structure/modules/infragistics.ui.shared.css" media="screen"></link>
<link type="text/css" rel="stylesheet" href="../../SCT/igniteui/css/structure/modules/infragistics.ui.grid.css" media="screen"></link>
<link type="text/css" rel="stylesheet" href="../../SCT/igniteui/css/structure/modules/infragistics.ui.popover.css" media="screen"></link>
<link type="text/css" rel="stylesheet" href="../../SCT/igniteui/css/structure/modules/infragistics.ui.validator.css" media="screen"></link>
<link type="text/css" rel="stylesheet" href="../../SCT/igniteui/css/structure/modules/infragistics.ui.editors.css" media="screen"></link>
<link type="text/css" rel="stylesheet" href="../../SCT/igniteui/css/structure/modules/infragistics.ui.tree.css" media="screen"></link>
<link type="text/css" rel="stylesheet" href="../../SCT/igniteui/css/structure/modules/infragistics.ui.combo.css" media="screen"></link>
</html>
那里应该有一个名为Rmenu的div,它去了哪里?是否存在一些我不知道的安全问题。很抱歉,如果我遗漏了任何内容,请在需要时添加更多代码。