JavaScript DHTML/Dojo toolkit/Popup Context Menu — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
|
(нет различий)
|
Текущая версия на 07:20, 26 мая 2010
ContextMenu setup
<html>
<head>
<link rel="StyleSheet" type="text/css" href="js/dojo/dijit/themes/tundra/tundra.css">
<script type="text/javascript">
var djConfig = {
baseScriptUri : "js/dojo/",
parseOnLoad : true
};
</script>
<script type="text/javascript" src="js/dojo/dojo/dojo.js"></script>
<script>
dojo.require("dojo.parser");
dojo.require("dijit.Menu");
</script>
</head>
<body class="tundra">
Right click to see the context menu.
<div dojoType="dijit.Menu" contextMenuForWindow="true"
style="display:none;">
<span dojoType="dijit.MenuItem"
onClick="alert("Item 1")">Item 1</span>
<span dojoType="dijit.MenuSeparator"></span>
<span dojoType="dijit.MenuItem"
onClick="alert("Item 2")">Item 2</span>
</div>
</body>
</html>
<html>
<head>
<link rel="StyleSheet" type="text/css" href="js/dojo/dijit/themes/tundra/tundra.css">
<script type="text/javascript">
var djConfig = {
baseScriptUri : "js/dojo/",
parseOnLoad : true
};
</script>
<script type="text/javascript" src="js/dojo/dojo/dojo.js"></script>
<script>
dojo.require("dojo.parser");
dojo.require("dijit.MenuItem");
dojo.require("dijit.Menu");
</script>
</head>
<body class="tundra">
<body class="tundra">
Right click in here to get the contextual menu.
<div id="context" style="background:#eee; height:300px; width:300px;"></div>
<div dojoType="dijit.Menu" targetNodeIds="context" style="display:none">
<div dojoType="dijit.MenuItem">foo
<script type="dojo/method" event="onClick" args="evt">alert("foo");</script>
</div>
<div dojoType="dijit.MenuItem">bar
<script type="dojo/method" event="onClick" args="evt">alert("bar");</script>
</div>
<div dojoType="dijit.MenuItem">baz
<script type="dojo/method" event="onClick" args="evt">alert("baz");</script>
</div>
</div>
</body>
</body>
</html>