since its for windows IE you can use oncontextmenu.
and even though the elements are created by the script they are still apart of the dom, which means they can be altered.
to completely replace the original context menu you will have to return false directly after calling for the display of your custom right click menu.
here is an example:
Code:
<html>
<body>
<div id=menu1 oncontextmenu="return myRightclick(this);">item one</div>
<div id=menu2 oncontextmenu="return myRightclick(this);">item two</div>
<div id=menu3 oncontextmenu="return myRightclick(this);">item three</div>
<div id=menu4 oncontextmenu="return myRightclick(this);">item four</div>
<div id=menu5 oncontextmenu="return myRightclick(this);">item five</div>
<div id=menu6 oncontextmenu="return myRightclick(this);">item six</div>
<div style="display:none;position:absolute;background-color:cdcdcd" id=rightMenu onclick="this.style.display='none';" onmouseout=hide() onmouseover=show()>
put content of menu here<br>
example would be the id value of the element right clicked on<Br>
<span id=sp1></span></div>
</body>
<script type=text/javascript>
var hid='';
function hide(){
hid=setTimeout("document.getElementById('rightMenu').style.display='none'",2000);
}
function show(){
clearTimeout(hid);
}
function myRightclick(elm){
rightdiv=document.getElementById('rightMenu');
document.getElementById('sp1').innerHTML="<b>"+elm.id+"</b>";
rightdiv.style.left=event.clientX-4;
rightdiv.style.top=event.clientY-4;
rightdiv.style.display='block';
}
</script>
</html>
of course i would advise not using this if each menu item when clicked on opens up a child menu that is an actual child node of the menu item element.
as the oncontextmenu eventhandler will be called for both elements. if however you have no choice, look into stopping propagation/bubbling.