PC6下载站

分类分类

页面中点击鼠标右键----弹出与windows界面相似的菜单

关注+2004-10-07作者:蓝点


            
             
              
             
            

               
               

            



            想在Web Form中做出与windows中相似的菜单,可是发帖问人又没人回,自己摸索郁闷了一天之后,终于在MSDN中找到了相似的方法,具体如下:

(下面的代码帖到记事本能直接运行查看)




oncontextmenu Event Sample





















LINK="#000000" VLINK="#808080" ALINK="#000000">



oncontextmenu Event Sample


This sample shows how to use the oncontextmenu event handler, available in Microsoft® Internet Explorer 5 and later, to display both standard and custom context menus and prevent context menus from displaying. Experiment with each of the following boxes to see how you can apply different methods either to display or to inhibit context menus. Each box provides instructions for you to follow.




1. The default context menu always displays when you right-click in this box.

Code:

//no code necessary





2. The default context menu displays only if you right-click in this box while holding down the Ctrl key. This is useful for developing and debugging purposes.

Code:

oncontextmenu="return event.ctrlKey"





3. A context menu never displays when you right-click in this box.

Code:

oncontextmenu="return false"





4. A custom context menu displays when you right-click in this box.

Code:

oncontextmenu="showMenu();return false;"





5. A custom menu displays when you right-click in this box. If you right-click while holding down the Ctrl key, the default context menu displays.

Code:

oncontextmenu="if (!event.ctrlKey){displayMenu();return false;}"












© 2003 Microsoft Corporation. All rights reserved..





  毕竟是MSDN,几乎是要什么有什么有什么啊.经过这次打击后,总结出经验:不会的东西不要很快就去问别人,靠自己摸索其实一样能找出另你满意的答案.

  不过还有一点很重要的是要学会查MSDN,输入的关键字要命中要害,可以说应该要一针见血.还有实在找不出的时候,就去查看目录,一级一级的往下找,总能找到你想要的.

展开全部

相关文章

更多+相同厂商

热门推荐

  • 最新排行
  • 最热排行
  • 评分最高
排行榜

    点击查看更多

      点击查看更多

        点击查看更多

        说两句网友评论

          我要评论...
          取消