,不会实现功能。
3 | * MenuBar的add()方法:bar.add("menu1", "item1", "http://www.qdmmy6.com/");
4 | * MenuBar的menus属性是一个数组(其时它是一个Map),每个元素对应一个menu。
5 | * 数组中的元素还是一个数组,这个数组中的元素是MenuItem对象。
6 | * add()方法首先查找menus["menu1"]元素(即名为"menu1"的菜单)是否存在,
7 | * 如果存在,使用"item1"与"http://www.qdmmy6.com/"创建MenuItem对象。然后把MenuItem对象添加到menus["menu1"]中去。
8 | * 如果不存在,先创建menus["menu1"],在把MenuItem添加进去。
9 | */
10 | function Q6MenuBar(objName, barName) {
11 | this.obj = objName;
12 | this.barName = barName;
13 | this.config = {
14 | topHeight:null,
15 | bottomHeight:null,
16 | width:null,
17 | radioButton:true,
18 | imgDir:"img/"
19 | };
20 | this.icon = {jiaIcon:"jia.png",jianIcon:"jian.png"};
21 | this.colorStyle = 2;
22 | this.colors = [];
23 | this.colors[0] = {
24 | menuBgColor:"rgb(246,133,1)",
25 | menuBorderColor:"rgb(236,171,87)",
26 | itemBgColor:"rgb(38,38,38)",
27 | itemBorderColor:"rgb(100,100,100)",
28 | itemBgMoveColor:"rgb(32,145,177)",
29 | itemBorderMoveColor:"rgb(119,171,113)",
30 | itemMoveColor:"rgb(255,255,255)",
31 | itemColor:"rgb(255,255,255)",
32 | menuBarColor:"rgb(255,255,255)",
33 | menuContentColor:"rgb(255,255,255)"
34 | };
35 | this.colors[2] = {
36 | itemBgMoveColor:"rgb(246,133,1)",
37 | itemBorderMoveColor:"rgb(236,171,87)",
38 | menuBgColor:"rgb(78,78,78)",//38
39 | menuBorderColor:"rgb(102,102,102)",//100
40 | itemBgColor:"rgb(32,145,177)",
41 | itemBorderColor:"rgb(119,171,113)",
42 | itemMoveColor:"rgb(255,255,255)",
43 | itemColor:"rgb(255,255,255)",
44 | menuBarColor:"rgb(255,255,255)",
45 | menuContentColor:"rgb(255,255,255)"
46 | };
47 | this.colors[1] = {
48 | menuBgColor:"rgb(25,119,176)",
49 | menuBorderColor:"rgb(211,211,211)",
50 | itemBgColor:"rgb(121,201,236)",
51 | itemBorderColor:"rgb(68,141,174)",
52 | itemBgMoveColor:"rgb(110,172,44)",
53 | itemBorderMoveColor:"rgb(172,221,74)",
54 | itemMoveColor:"rgb(255,255,255)",
55 | itemColor:"rgb(255,255,255)",
56 | menuBarColor:"rgb(255,255,255)",
57 | menuContentColor:"#333333"
58 | };
59 | this.colors[3] = {
60 | menuBgColor:"rgb(159,153,138)",
61 | menuBorderColor:"rgb(142,132,107)",
62 | itemBgColor:"rgb(254,238,189)",
63 | itemBorderColor:"rgb(164,91,19)",
64 | itemBgMoveColor:"rgb(252,211,61)",
65 | itemBorderMoveColor:"rgb(164,91,19)",
66 | itemMoveColor:"rgb(76,48,0)",
67 | itemColor:"rgb(0,116,199)",
68 | menuBarColor:"rgb(76,48,0)",
69 | menuContentColor:"rgb(76,48,0)"
70 | };
71 | this.font = {
72 | };
73 | this.menus = [];
74 | //
' + barName + '
75 | }
76 |
77 | /*
78 | * 添加方法
79 | * 首先查看this.menus[menuName]这个菜单(就是一个数组)是否存在。
80 | * 如果不存在,先创建这个菜单(数组)。
81 | * 使用menuItemName和url创建MenuItem对象,把MenuItem对象添加到菜单(数组)尾部。
82 | * frameName -- 指定在哪个帧中打开页面
83 | */
84 | Q6MenuBar.prototype.add = function(menuName, menuItemName, url, frameName) {
85 | if (!this.menus[menuName]) {
86 | this.menus[menuName] = [];
87 | }
88 | var len = this.menus[menuName].length;
89 | this.menus[menuName][len] = new MenuItem(menuItemName, url, frameName);
90 |
91 | // MenuItem类
92 | function MenuItem(menuItemName, url, frameName) {
93 | this.menuItemName = menuItemName;
94 | this.url = url;
95 | this.frameName = frameName;
96 | }
97 | }
98 | /*
99 | MenuBar的toString()方法
100 | 该方法会生成与MenuBar相关的HTML代码,然后遍历menus属性,生成每个菜单对应HTML代码。
101 | */
102 | Q6MenuBar.prototype.toString = function() {
103 | // menuBar对应的
104 | var str = '