When I try to create a context menu using dhtmlxmenu.js, I always get the following error (and no context menu):
Message: 'tbd' is null or not an object
Line: 35
Char: 212
Code: 0
URI: http://localhost/dhtmlx/menu/dhtmlxmenu.js
What am I doing wrong? Example code is below (I believe it is very similar to the sample code provided by dhtmlx, except that I need to configure the context menu from script rather than from XML as is done in the online examples):
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>DHTMLX Test Page</title>
<link rel="STYLESHEET" type="text/css" href="dhtmlx/dts/dhtmlxmenu_dhx_skyblue.css" />
</head>
<script type="text/javascript" src="jquery/jquery-1.4.1.min.js"></script>
<script type="text/javascript" src="dhtmlx/common/dhtmlxcommon.js"></script>
<script type="text/javascript" src="dhtmlx/menu/dhtmlxmenu.js"></script>
<script type="text/javascript" src="dhtmlx/menu/dhtmlxmenu_ext.js"></script>
<script type="text/javascript">
var mMyMenu;
$(function() {
mMyMenu = new dhtmlXMenuObject();
mMyMenu.setIconsPath("dhtmlx/images/");
mMyMenu.renderAsContextMenu();
mMyMenu.addContextZone("divMenuArea");
mMyMenu.addNewSibling(mMyMenu.topId, "testitem", "Test", false);
});
</script>
<body>
<div style="height: 400px; position: relative;">
<div id="divMenuArea" style="position: absolute; left: 100px; top: 100px; width: 400px; height: 200px; border: #A0A0A0 1px solid; background-color: #E0F0E0;">
<p>Click here for context menu.</p>
</div>
</div>
</body>
</html>
Thanks for any assistance!
- David