标签:style blog http io ar color os 使用 sp
//----------使用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{width: 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>
标签:style blog http io ar color os 使用 sp
原文地址:http://www.cnblogs.com/fleshy/p/4129004.html