jquery-插件之右键菜单的使用

下载其js,css,img资源

http://www.javascripttoolbox.com/lib/contextmenu/source.php

 

 

使用案例

 

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ContextMenu.aspx.cs" Inherits="UI_ContextMenu" %>

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

 

<html xmlns="http://www.w3.org/1999/xhtml" >

<head runat="server">

    <title>Jquery 插件之右键菜单的使用 -by wangtao </title>

    <script type="text/javascript" src="../Misc/Js/Core/Jquery.js"></script>

    <script type="text/javascript" src="../Misc/Js/Plugins/jquery.contextmenu.js"></script>

    <link type="text/css" href="../Misc/Css/jquery.contextmenu.css" />

</head>

<body>

<script type="text/javascript">

var menu1 = [ {'Option 1':function(menuItem,menu) { alert("You clicked Option 1!"); } }, $.contextMenu.separator, {'Option 2':function(menuItem,menu) { alert("You clicked Option 2!"); } } ];

var menu3 = [ {'Show Alert':{ onclick:function(menuItem,menu) { alert("You clicked me!"); }, className:'menu3-custom-item', hoverClassName:'menu3-custom-item-hover', title:'This is the hover title' } }, {'Delete':{ onclick:function(menuItem,menu) { if(confirm('Are you sure?')){$(this).remove();} }, icon:'delete_icon.gif', disabled:false } }, {'Custom Hover Functions':{ hoverItem:function(c) { $(this).addClass(c).find('div').html('You just hovered over me!'); }, hoverItemOut:function(c) { $(this).removeClass(c).find('div').html('Sorry to see you go!'); } } }, {"You can't click me!":{disabled:true} } ]; 

$(function(){

  $('.cmenu1').contextMenu(menu1,{theme:'vista'}); 

  $('.cmenu2').contextMenu('#menu2'); 

  $('.cmenu3').contextMenu(menu3,{theme:'vista'}); 

})

</script>

 

    <div id="menu2" style="display:none;width:200px;background-color:white;border:1px solid black;padding:5px;">  This is my custom context menu </div>

    <span class="cmenu1 example-target">Right-click here to trigger the context menu</span>

    <p></p>

    <span class="cmenu2 example-target">Right-click here to trigger the context menu</span>

    <p></p>

    <span class="cmenu3 example-target">Right-click here to trigger the context menu</span>

 

</body>

</html>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值