CSS自定义右键菜单
<style> .menu { width: 100px; font-size: 14px; font-family: "微软雅黑"; border: 1px solid #ccc; z-index: 9999; position: absolute; display: none; background: #f2f2f2; } .menu ul { margin: 0px; padding: 0px; text-align: center; list-style-type: none; } .menu ul li { padding: 3px 0px; font-size: 12px; } .menu ul li:hover { background: #e1dddd; } .menu ul li a:link { color: #000; text-decoration: none; } </style>
<!--右侧菜单--> <div id="divmenu" class="menu"> <ul> <li onclick="expand_all()" class="pub">展开所有</li> <li onclick="collapse_all()" class="pub">合并所有</li> <li onclick="zoomIn()" class="pub">画布放大</li> <li onclick="zoomOut()" class="pub">画布缩小</li> <li onclick="add_node();" class="add">新增节点</li> <li onclick="openWin();" class="view">预览</li> <li onclick="update_node();" class="update">变更</li> <li onclick="add_upfile();" class="upload">上传图纸</li> <li onclick="show_selected();" class="sel">查看节点</li> <li onclick="remove_node()" class="delete">删除</li> </ul> </div>
<script type="text/javascript"> $("body").bind("contextmenu", function () {
$("#divmenu").css({ "left": document.body.scrollLeft + event.clientX - 125, "top":
document.body.scrollTop + event.clientY - 60 }).show();
return false; }); </script>