62,254
社区成员
发帖
与我相关
我的任务
分享
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>无标题页</title>
<script language="javascript" type="text/javascript">
var x, y;
function ShowMenu()
{
if (event.button == 2)
{
x=document.body.scrollLeft+event.clientX; //获取当前鼠标位置的X坐标
y=document.body.scrollTop+event.clientY; //获取当前鼠标位置的Y坐标
var menu = document.getElementById("popMenu");
menu.style.top = y;
menu.style.left = x;
// if (menu.style.display == "none")
//
// menu.style.display = "block";
// else
// menu.style.display = "none";
}
}
document.onmousedown=ShowMenu;
document.oncontextmenu = new Function("return false");
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<div id="popMenu" style="width:50px; height:120px; position:absolute; border:solid 1px red; font-size:12px;">
新建<br /><br />
打开<br /><br />
保存<br /><br />
退出<br /><br />
</div>
</div>
</form>
</body>
</html>