Dron右键菜单 v1.0_Javascript教程-查字典教程网
Dron右键菜单 v1.0
Dron右键菜单 v1.0
发布时间:2016-12-30 来源:查字典编辑
摘要:NewDocument/*******************************************Dron右键菜单v1.0Thi...

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需刷新才能执行]

相关阅读
推荐文章
猜你喜欢
附近的人在看
推荐阅读
拓展阅读
  • 大家都在看
  • 小编推荐
  • 猜你喜欢
  • 最新Javascript教程学习
    热门Javascript教程学习
    编程开发子分类