New Document /******************************************* Dron右键菜单 v1.0 This JavaScript was writen by Dron. @2003-2008 Ucren.com All rights reserved. (转载或应用请保留此版权信息) *******************************************/ var ie = (navigator.appVersion.indexOf("MSIE")!=-1);//IE var ff = (navigator.userAgent.indexOf("Firefox")!=-1);//Firefox document.write(""); document.write(""); Array.prototype.c = Array.prototype.concat; function buffer() { var s = []; s = s.c(["项目一"]); s = s.c(["项目二"]); s = s.c(["项目三"]); s = s.c(["项目四"]); s = s.c(["项目五"]); s = s.c(["项目六"]); s = s.c(["项目七"]); s = s.c(["项目作"]); s = s.join(""); document.getElementById("rightmenu").innerHTML = s; } var rightmenu = document.getElementById("rightmenu"); var rightmenubg = document.getElementById("rightmenubg"); var body = document.body; var ex=0,ey=0; function showcontextmenu(evt) { ex = evt.clientX;ey = evt.clientY; rxy(); rightmenu.style.display = "block"; rightmenubg.style.display = "block"; evt.cancelBubble = true; return false; } function bodyclick(evt) { rightmenu.style.display = "none";//关闭右键菜单 rightmenubg.style.display = "none";//关闭右键菜单 } function rxy() { var step=3; if(ie){step=1} if(ff){step=6} if(ex+150>body.clientWidth) { rightmenu.style.left = ex - 150; rightmenubg.style.left = ex - 150 + step; } else { rightmenu.style.left = ex; rightmenubg.style.left = ex + step; } if(ey+200>body.clientHeight) { rightmenu.style.top = ey - 160; rightmenubg.style.top = ey - 160 + step; } else { rightmenu.style.top = ey; rightmenubg.style.top = ey + step; } } function showcontextmenu(evt) { ex = evt.clientX;ey = evt.clientY; rxy(); rightmenu.style.display = "block"; rightmenubg.style.display = "block"; evt.cancelBubble = true; return false; } window.onload = function() { buffer(); }
[Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]