Jquery 右键菜单

欢迎技术交流。 QQ:138986722

需要的插件、到这里下载:http://download.csdn.net/source/3284255。

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <% String path = request.getContextPath(); String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <base href="<%=basePath%>"> <title>旦旦而学</title> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta http-equiv="expires" content="0"> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta http-equiv="description" content="This is my page"> <mce:script type="text/javascript" src="js/jquery-1.4.2.js" mce_src="js/jquery-1.4.2.js" ></mce:script> <mce:script type="text/javascript" src="js/contextmenufunction.js" mce_src="js/contextmenufunction.js" ></mce:script> <mce:script type="text/javascript" src="js/jquery.contextmenu.js" mce_src="js/jquery.contextmenu.js" ></mce:script> <link rel="stylesheet" type="text/css" href="js/jquery.contextmenu.css" mce_href="js/jquery.contextmenu.css"> <SCRIPT type="text/javascript"> function addMeetShow(){ alert('悟空、有妖孽!'); } function myrefresh(){ window.location.reload(); } function myMenu3(){ alert('方法3'); } function myMenu4(){ alert('方法4'); } function myMenu5(){ alert('方法5'); } function myMenu6(){ alert('方法6'); } function showContextMenu(id) { var menu = [ { '新增':{ onclick:function(menuItem,menuObject) { addMeetShow(); return false; }, icon:'<%=path %>/images/icons/btn_new2_16x16.gif' } }, $.contextMenu.separator, { '刷新':{ onclick:function(menuItem,menuObject) { myrefresh(); return false; }, icon:'<%=path %>/images/icons/refresh.gif' } }, $.contextMenu.separator, { '3新':{ onclick:function(menuItem,menuObject) { myMenu3(); return false; }, icon:'<%=path %>/images/icons/refresh.gif' } }, $.contextMenu.separator, { '4新':{ onclick:function(menuItem,menuObject) { myMenu4(); return false; }, icon:'<%=path %>/images/icons/refresh.gif' } }, $.contextMenu.separator, { '5新':{ onclick:function(menuItem,menuObject) { myMenu5(); return false; }, icon:'<%=path %>/images/icons/refresh.gif' } }, $.contextMenu.separator, { '6新':{ onclick:function(menuItem,menuObject) { myMenu6(); return false; }, icon:'<%=path %>/images/icons/refresh.gif' } } ]; $(document).contextMenu(menu,{showTransition:'myCustomShow',hideTransition:'myCustomHide',showSpeed:500,hideSpeed:500,useIframe:false,shadow:false,theme:'vista'}); } </SCRIPT> <mce:style><!-- body{ margin: 0;font-size:12px} .rightkey{font-size: 12px;} --></mce:style><style mce_bogus="1"> body{ margin: 0;font-size:12px} .rightkey{font-size: 12px;} </style> </head> <body oncontextmenu="showContextMenu('0')"> <div id="testDiv"> <h3>请单击鼠标右键!!!</h3> </div> </body> </html>

你可能感兴趣的:(Jquery 右键菜单)