<html>
<head>
<meta charset="utf-8">
<title></title>
<style type="text/css">
ul{
width: 100px;
height: 100px;
background: coral;
display: none;
position: absolute;
left:100px;
top:50px;
}
</style>
</head>
<body>
<ul id="ul">
<li>菜单一</li>
<li>菜单二</li>
</ul>
</body>
</html>
<script type="text/javascript">
//鼠标右键菜单
document.oncontextmenu=function(){
document.getElementById("ul").style.display="block";
return false; //阻止默认行为
}
//单击空白的就隐藏
document.onclick=function(){
document.getElementById("ul").style.display="none";
}
</script>