I've created a table and coded the oncontextmenu event of the <tr> elements to return false. I've coded the onmouseup events of same to display an absolutely positioned div with z-index of 1 as a context menu whenever the <tr> element is right-clicked. The problem is when I scroll the page the context menu remains in the same place in the browser window, although the <tr> element it refers to scrolls up out of sight. How can I make a context menu that will remain in the same position relative to its <tr> element, even when the page scrolls?
I use the document.createElement() method to create the div, then use the appendChild() method to add it to the <td> element of the <tr>.