Hi everyone
I’m having some trouble using dhtmlxmenu as a context menu in a map element. My code looks like this:
Map element:
<IMG style="POSITION: absolute; TOP: 20px; LEFT: 20px" border=0 src="image.gif" useMap=#dump>
<MAP name=dump>
<AREA id="0" href="#" shape=rect coords=0,0,237,374>
<AREA id="1" href="#" shape=rect coords=237,0,474,374>
</MAP>
Menu loading:
var aMenu;
function initContextMenu() {
aMenu = new dhtmlXMenuObject();
aMenu.renderAsContextMenu();
var pos = 0;
aMenu.addNewChild(null,pos++,"zoomin","Zoom IN",false,null);
aMenu.addNewChild(null,pos++,"zoomout","Zoom OUT",false,null);
aMenu.addContextZone("0");
aMenu.addContextZone("1");
}
This doesn’t work: there’s no way to get the menu working. However, if I remove the map and add a simple div schema (copied from the dhtmlxmenu samples), it works perfectly. This is the div schema I use:
<div style="height: 400px; position: relative;">
<div id="0" style="position: absolute; left: 100px; top: 100px; width: 100px; height: 60px; border: #C1C1C1 1px solid; background-color: #E7F4FF;">zone A</div>
<div id="1" style="position: absolute; left: 220px; top: 100px; width: 100px; height: 60px; border: #C1C1C1 1px solid; background-color: #E7F4FF;">zone B</div>
</div>
Am I doing something wrong? Can dhtmlxmenu be used in a map element?
Thanks!