Hello All,<br><br>i was investigating how to add the popup menu to the right click event. as of now, i found a code piece so that i can capture the coordinate of right click. i also found &quot;OpenLayers.Popup&quot; function. however, when i use &quot;&quot;OpenLayers.Popup&quot;&quot; function, the popup appears on top of the map. instead, i want it to appear at mouse cursor when the user right clicks. <br>

<br>i think i need to combine the right click event with the popup creation but since i am a total newbie with coding, i cannot do it. can anyone help me?<br><br>thanks.<br><br>this is my code<br><br>----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------<br>

<br>&lt;!DOCTYPE html&gt;<br>&lt;html lang=&#39;en&#39;&gt;<br>&lt;head&gt;<br>&lt;meta charset=&#39;utf-8&#39; /&gt;<br>&lt;title&gt;ismetb map&lt;/title&gt;<br>&lt;script type=&#39;text/javascript&#39; src=&#39;OpenLayers.js&#39;&gt;&lt;/script&gt;<br>

&lt;script type=&#39;text/javascript&#39;&gt;<br><br>var map;<br><br>function init() {<br>map = new OpenLayers.Map(&#39;map_element&#39;, {});<br>var wms = new OpenLayers.Layer.WMS(<br>&#39;OpenLayers WMS&#39;,<br>&#39;<a href="http://vmap0.tiles.osgeo.org/wms/vmap0">http://vmap0.tiles.osgeo.org/wms/vmap0</a>&#39;,<br>

{layers: &#39;basic&#39;},<br>{}<br>);<br><br>map.addLayer(wms);<br>if(!map.getCenter()){<br>map.zoomToMaxExtent();<br>}<br>// Get control of the right-click event:<br>document.getElementById(&#39;map_element&#39;).oncontextmenu = function(e){<br>

  e = e?e:window.event;<br> if (e.preventDefault) e.preventDefault(); // For non-IE browsers.<br> else return false; // For IE browsers.<br>};<br><br><br>// A control class for capturing click events...<br>OpenLayers.Control.Click = OpenLayers.Class(OpenLayers.Control, {                <br>

<br>defaultHandlerOptions: {<br>&#39;single&#39;: true,<br>&#39;double&#39;: true,<br>&#39;pixelTolerance&#39;: 0,<br>&#39;stopSingle&#39;: false,<br>&#39;stopDouble&#39;: false<br>},<br>handleRightClicks:true,<br>initialize: function(options) {<br>

this.handlerOptions = OpenLayers.Util.extend(<br>{}, this.defaultHandlerOptions<br>);<br>OpenLayers.Control.prototype.initialize.apply(<br>this, arguments<br>); <br>this.handler = new OpenLayers.Handler.Click(<br>this, this.eventMethods, this.handlerOptions<br>

);<br>},<br>CLASS_NAME: &quot;OpenLayers.Control.Click&quot;<br><br>});<br><br><br>// Add an instance of the Click control that listens to various click events:<br>var oClick = new OpenLayers.Control.Click({eventMethods:{<br>

&#39;rightclick&#39;: function(e) {<br>alert(&#39;rightclick at &#39;+e.xy.x+&#39;,&#39;+e.xy.y);<br>},<br>//&#39;click&#39;: function(e) {<br>//alert(&#39;click at &#39;+e.xy.x+&#39;,&#39;+e.xy.y);<br>//},<br>//&#39;dblclick&#39;: function(e) {<br>

//alert(&#39;dblclick at &#39;+e.xy.x+&#39;,&#39;+e.xy.y);<br>//},<br>//&#39;dblrightclick&#39;: function(e) {<br>//alert(&#39;dblrightclick at &#39;+e.xy.x+&#39;,&#39;+e.xy.y);<br>//}<br>}});<br>map.addControl(oClick);<br>

oClick.activate();<br><br>}<br><br> &lt;/script&gt;<br>&lt;/head&gt;<br><br>&lt;body onload=&#39;init();&#39;&gt;<br>&lt;div id=&#39;map_element&#39; style=&#39;width: 400px; height: 400px;&#39;&gt;<br>&lt;/div&gt;<br>&lt;/body&gt;<br>

&lt;/html&gt;<br><br>----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------<br>

and this is popup example:<br><br><blockquote><pre class="prettyprint"><span class="pln">popup </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">new</span><span class="pln"> </span><span class="typ">OpenLayers</span><span class="pun">.</span><span class="typ">Popup</span><span class="pun">(</span><span class="str">&quot;chicken&quot;</span><span class="pun">,</span><span class="pln"><br>

                   </span><span class="kwd">new</span><span class="pln"> </span><span class="typ">OpenLayers</span><span class="pun">.</span><span class="typ">LonLat</span><span class="pun">(</span><span class="lit">5</span><span class="pun">,</span><span class="lit">40</span><span class="pun">),</span><span class="pln"><br>

                   </span><span class="kwd">new</span><span class="pln"> </span><span class="typ">OpenLayers</span><span class="pun">.</span><span class="typ">Size</span><span class="pun">(</span><span class="lit">200</span><span class="pun">,</span><span class="lit">200</span><span class="pun">),</span><span class="pln"><br>

                   </span><span class="str">&quot;example popup&quot;</span><span class="pun">,</span><span class="pln"><br>                   </span><span class="kwd">true</span><span class="pun">);</span><span class="pln"><br>

<br>map</span><span class="pun">.</span><span class="pln">addPopup</span><span class="pun">(</span><span class="pln">popup</span><span class="pun">);<br><br><br></span></pre></blockquote><br>