zoukankan      html  css  js  c++  java
  • Day9--------onContextMenu

     //----------使用oncontextmenu和return false来添加自定义的右键菜单和屏蔽浏览器默认菜单
    1
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 2 <html xmlns="http://www.w3.org/1999/xhtml"> 3 <head> 4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 5 <title>contextMenu</title> 6 </head> 7 <style type="text/css"> 8 ul,body{margin: 0px;padding: 0px;} 9 ul{ 110px;height: 150px;position: absolute;background: #CCC;display: none;list-style-type: none;} 10 </style> 11 <script type="text/javascript"> 12 window.onload=function(){ 13 oUl=document.getElementsByTagName('ul')[0]; 14 document.oncontextmenu=function(ev){ 15 oEvent=ev||event; 16 oUl.style.display='block'; 17 oUl.style.left=oEvent.clientX+'px'; 18 oUl.style.top=oEvent.clientY+'px'; 19 return false; 20 } 21 document.onclick=function(){ 22 oUl.style.display='none'; 23 } 24 } 25 </script> 26 <body> 27 <ul> 28 <li>Send TO C:</li> 29 <li>Send TO D:</li> 30 <li>Send TO E:</li> 31 <li>Send TO F:</li> 32 </ul> 33 </body> 34 </html>
  • 相关阅读:
    一周入门Linux 基础篇 虚拟机迁移和删除
    java修饰符的总结
    磁力种子搜索的网站
    python+爬虫+签名
    python中的matplotlib的一些基础用法
    K-means算法的实现
    Java的学习04
    Java的学习03
    Java的学习02
    Java的学习01
  • 原文地址:https://www.cnblogs.com/fleshy/p/4129004.html
Copyright © 2011-2022 走看看