web下的UI System (转)

web下的UI System (转)[@more@]

 

大家好,我用Javascript写了一套web下的UI System,主要是树和菜单。请大家提提意见。

menu:

//ui 实现

IMAGES_PATH = "images/"

var  TopMenus  = new Array();
var  FileItems  = new Array();
var  EditItems  = new Array();
var  ToolsItems = new Array();
var  HelpItems  = new Array();

var  subMenu  = new Array();

TopMenus[0] = new TopMenu("File","文件");  // subMenu,display
TopMenus[1] = new TopMenu("Edit","编辑");
TopMenus[2] = new TopMenu("Tools","工具");
TopMenus[3] = new TopMenu("Help","帮助");

addTopMenu(TopMenus);

//File menu items
FileItems[0] = new MenuItem("images/open0.gif","新建","onFileOpen");
FileItems[1] = new MenuItem("open0.gif","打开");
FileItems[2] = new MenuItem("open0.gif","关闭");
FileItems[3] = new MenuItem("","退出","onFileExit");


//Edit menu items
EditItems[0] = new MenuItem("open0.gif","剪切");
EditItems[1] = new MenuItem("open0.gif","删除");
EditItems[2] = new MenuItem("close0.gif","复制");

//Tools menu items
ToolsItems[0] = new MenuItem("open0.gif","管理");
ToolsItems[1] = new MenuItem("open0.gif","安全");
ToolsItems[2] = new MenuItem("open0.gif","选项",null,"OptionFont");

//Help menu items
HelpItems[0] = new MenuItem("open0.gif","参照");
HelpItems[1] = new MenuItem("open0.gif","联机文档");
HelpItems[2] = new MenuItem("open0.gif","Web");


var FontItems = new Array();

FontItems[0] = new MenuItem("../images/open0.gif","宋体");
FontItems[1] = new MenuItem("../images/open0.gif","行体");
FontItems[2] = new MenuItem("../images/open0.gif","草体");


addSubMenu("File",FileItems);  //Id,MenuItems
addSubMenu("Edit",EditItems);
addSubMenu("Tools",ToolsItems);
addSubMenu("Help",HelpItems);
addSubMenu("OptionFont",FontItems);

function onFileOpen()
{
  //ToDo
}

function onFileExit()
{
  window.close();
}
document.onclick  = onClick;  // 捕获click事件
document.onmouseover = onMouseOver;  // 捕获mouseover事件
document.onmouseout  = onMouseOut;  // 捕获mouseout事件

运行效果:


来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/10752043/viewspace-989635/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/10752043/viewspace-989635/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值