当前位置: 首页 > 图文教程 > 网络编程 > Javascript > js实现的XP风格的右键菜单

Javascript
form中限制文本字节数js代码
use jscript with List Proxy Server Information
use jscript List Installed Software
List Installed Software Features
List Information About the Binary Files Used by an Application
List the Codec Files on a Computer
List the UTC Time on a Computer
List Installed Hot Fixes
excel操作之Add Data to a Spreadsheet Cell
Add Formatted Data to a Spreadsheet
Apply an AutoFormat to an Excel Spreadsheet
JavaScript语法着色引擎(demo及打包文件下载)
类之Prototype.js学习
一款JavaScript压缩工具:X2JSCompactor
iis6+javascript Add an Extension File
jscript之Open an Excel Spreadsheet
jscript之Read an Excel Spreadsheet
jscript之List Excel Color Values
去除图像或链接黑眼圈的两种方法总结
Add a Formatted Table to a Word Document

Javascript 中的 js实现的XP风格的右键菜单


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-10-12   浏览: 420 ::
收藏到网摘: n/a

使用说明:
在使用前,先建立菜单对象
var obj = new MouseMenu("obj");
注意,obj 要和 MouseMenu("obj") 的obj 相同
如建立了 obj 那么 obj 将会有以下方法,开始 obj.length = 0
方法:
1. addMenu(express[,icon][,url][,target][,title]);
功能: 插入一个菜单,并且 返回一个功能和上面说 提起的 obj 一样的菜单对象
obj[obj.length] 然后 obj.length 将会 +1
说明:
express 必须,字符串,显示在插入的菜单上的文本
icon 可选,整数(>0),如果后面有选项,你不需要ICON的话,填写 ""
url 可选,字符串,路径
target 可选,字符串 就是 target
title 可选,字符串 就是 title
2. addLink(express,[,icon][,url][,target][,title])
功能: 插入一个连接 然后 obj.length 将会 +1
说明
express 必须,字符串,显示在插入的菜单上的文本
icon 可选,整数(>0),如果后面有选项,你不需要ICON的话,填写 ""
url 必须,字符串,路径
target 可选,字符串 就是 target
title 可选,字符串 就是 title
3. addHR()
功能: 插入分割线
说明:
他不属于 link 和 menu 对象 所以使用时,obj.length 不变
比如:
var MM = new MouseMenu("MM")
MM.addLink("连接","","http://hello.com")
MM.addHR()
MM.addMenu("菜单")
//下面 是 MM[1] 而不是 MM[2] 因为 MM.addHR() MM.length 不会增加
MM[1].addLink("连接","","http://hello.com")
好了,说了这么多,应该会用了吧?
突然有人问:“在哪插入连接……”
…… 嗯~ 这个 ^_^! 看上面吧~~~~
附加:在代码中的其他的数据
//--------------- 有关数据 -----------------//
var IconList = new Array(); // icon图片 集合, 下标从 1 开始
IconList[1] = new Image();
IconList[1].src = "icon/sub.gif";
//--------------------------- 声音开关 ------ 声音开关 ------------------//
var mouseCanSound = true;
var menuSpeed = 50; //---------- 菜单显示速度 ------------//
var alphaStep = 30; //---------- Alpaha 变化 度 -----------//
点击运行可以看到效果:
[Ctrl+A 全选 提示:你可先修改部分代码,再按运行]