Sandfordc said:
Well,
If your still interested all you have to do is:
Why have you posted this as a response to David Dorward? David a) knows
how to do this, and b) doesn't want to do it. It would make more sense
to respond to the OP, who wants to do it but doesn't know how.
1) Set an event capture eg. onmousedown=
A context menu facility makes more sense attached to - oncontextmenu -,
else alternative methods of triggering the menu are unavailable (such as
the contetxmenu button that appears on keyboards). Capturing mousedown
is not a lot of use unless you can distinguish between non-content menu
mousedown activity and activity that will open a context menu on the
system. The usual approach of testing for the right button being pressed
misses a lot of possible user configuration permutations.
2) Capture the cordinates of the mouse at that time
(sorry i forgot the command)
There is no mouse co-ordinates 'command'. Mouse co-ordinated, relative
to numerous co-ordinate systems (page, viewport, screen and so on), are
available as properties of (mouse event) objects, and must be extracted
(and usually normalised to a consistent system for use).
3) Set a DIV or SPAN to appear there with the contents
of your menu
DIV and SPAN elements have a lot of similarities, being semantically
neutral elements that exist for the application of CSS to arbitrary
sections of mark-up. They also have a very significant difference in
that DIV is a block element and SPAN is an inline element. That
difference means that in any context of use (including this one) only
one of them could be appropriate, to the exclusion of the other.
Suggesting that they may be interchangeable, or that the choice between
the two is arbitrary, implies a superficial grasp of HTML.
In addition; triggering a scripted context menu from any event (mouse
own or contextmenu) will make for a confusing GUI unless the browser's
context menu is in some way blocked/cancelled. As some environments
allow the user to veto the blocking/cancelling of the browser's context
menu this entire notion is inappropriate in a public Internet context.
Richard.