http://www.codesky.net/article/201109/1200js/%E5%AE%9E%E7%94%A8%E5%AF%BC%E8%88%AA%E8%8F%9C%E5%8D%95.htm

可直接保存为HTML文件,在不同浏览器上打开。

  1. 脚本说明:
  2.  
  3. 把如下代码加入<body>区域中
  4.  <script language=javascript>
  5.  
  6. var mmenus = new Array();
  7. var misShow = new Boolean();
  8. misShow=false;
  9. var misdown = new Boolean();
  10. misdown=false;
  11. var mnumberofsub=0;
  12. var musestatus=false;
  13. var mpopTimer = 0;
  14. /*
  15. mmenucolor='Menu';
  16. mfontcolor='MenuText';
  17. mmenuoutcolor='#B5BED6';
  18. mmenuincolor='#B5BED6';
  19. mmenuoutbordercolor='#000000';
  20. mmenuinbordercolor='#000000';
  21. mmidoutcolor='#8D8A85';
  22. mmidincolor='#8D8A85';
  23. mmenuovercolor='MenuText';
  24. mitemedge='1';
  25. msubedge='0';
  26. mmenuunitwidth=100;
  27. mmenuitemwidth=110;
  28. mmenuheight=25;
  29. mmenuwidth='100%';
  30. mmenuadjust=0;
  31. mmenuadjustV=0;
  32. mfonts='font-family: 宋体; font-size: 9pt; color: MenuText; ';mcursor='default';
  33. */
  34.  
  35. mmenucolor='#666666';mfontcolor='#FFFFFF';mmenuoutcolor='#999999';mmenuincolor='#3E9DD7';mmenuoutbordercolor='#ffffff';mmenuinbordercolor='#ffffff';mmidoutcolor='#ffffff';mmidincolor='#ffffff';mmenuovercolor='#ffffff';mitemedge='0';msubedge='1';mmenuunitwidth=82;mmenuitemwidth=140;mmenuheight=25;mmenuwidth='100%';mmenuadjust=0;mmenuadjustV=0;mfonts='font-family: 宋体; font-size: 9pt; color: #ffffff; ';mcursor='hand';
  36.  
  37. function stoperror(){
  38. return true;
  39. }
  40.  
  41. window.onerror=stoperror;
  42.  
  43. function mpopOut() {
  44. mpopTimer = setTimeout('mallhide()', 500);
  45. }
  46.  
  47. function getReal(el, type, value) {
  48. temp = el;
  49. while ((temp != null) && (temp.tagName != "BODY")) {
  50. if (eval("temp." + type) == value) {
  51. el = temp;
  52. return el;
  53. }
  54. temp = temp.parentElement;
  55. }
  56. return el;
  57. }
  58.  
  59. function mMenuRegister(menu)
  60. {
  61. mmenus[mmenus.length] = menu
  62. return (mmenus.length - 1)
  63. }
  64.  
  65. function mMenuItem(caption,command,target,isline,statustxt,level,img,sizex,sizey,pos){
  66. this.items = new Array();
  67. this.caption=caption;
  68. this.command=command;
  69. this.target=target;
  70. this.isline=isline;
  71. this.statustxt=statustxt;
  72. if(level!=null){mnumberofsub++;
  73. this.hasc=mnumberofsub;}
  74. this.level=level;
  75. this.img=img;
  76. this.sizex=sizex;
  77. this.sizey=sizey;
  78. this.pos=pos;
  79. }
  80.  
  81. function mMenu(caption,command,target,img,sizex,sizey,pos){
  82. this.items = new Array();
  83. this.caption=caption;
  84. this.command=command;
  85. this.target=target;
  86. this.img=img;
  87. this.sizex=sizex;
  88. this.sizey=sizey;
  89. this.pos=pos;
  90. this.id=mMenuRegister(this);
  91. }
  92. function mMenuAddItem(item)
  93. {
  94. this.items[this.items.length] = item
  95. item.parent = this.id;
  96. this.children=true;
  97. }
  98.  
  99. mMenu.prototype.addItem = mMenuAddItem;
  100. mMenuItem.prototype.addsubItem = mMenuAddItem;
  101.  
  102. function mtoout(src){
  103.  
  104. src.style.borderLeftColor=mmenuoutbordercolor;
  105. src.style.borderRightColor=mmenuinbordercolor;
  106. src.style.borderTopColor=mmenuoutbordercolor;
  107. src.style.borderBottomColor=mmenuinbordercolor;
  108. src.style.backgroundColor=mmenuoutcolor;
  109. src.style.color=mmenuovercolor;
  110. }
  111. function mtoin(src){
  112.  
  113. src.style.borderLeftColor=mmenuinbordercolor;
  114. src.style.borderRightColor=mmenuoutbordercolor;
  115. src.style.borderTopColor=mmenuinbordercolor;
  116. src.style.borderBottomColor=mmenuoutbordercolor;
  117. src.style.backgroundColor=mmenuincolor;
  118. src.style.color=mmenuovercolor;
  119. }
  120. function mnochange(src){
  121. src.style.borderLeftColor=mmenucolor;
  122. src.style.borderRightColor=mmenucolor;
  123. src.style.borderTopColor=mmenucolor;
  124. src.style.borderBottomColor=mmenucolor;
  125. src.style.backgroundColor='';
  126. src.style.color=mfontcolor;
  127.  
  128. }
  129. function mallhide(){
  130. for(var nummenu=0;nummenu<mmenus.length;nummenu++){
  131. var themenu=document.all['mMenu'+nummenu]
  132. var themenudiv=document.all['mmenudiv'+nummenu]
  133. mnochange(themenu);
  134. mmenuhide(themenudiv);
  135. }
  136. for(nummenu=1;nummenu<=mnumberofsub;nummenu++){
  137. var thesub=document.all['msubmenudiv'+nummenu]
  138. msubmenuhide(thesub);
  139. mnochange(document.all['mp'+nummenu]);
  140. document.all["mitem"+nummenu].style.color=mfontcolor;
  141. }
  142. }
  143. function mmenuhide(menuid){
  144.  
  145. menuid.style.visibility='hidden';
  146. misShow=false;
  147. }
  148. function msubmenuhide(menuid){
  149.  
  150. menuid.style.visibility='hidden';
  151. }
  152. function mmenushow(menuid,pid){
  153.  
  154. menuid.style.left=mposflag.offsetLeft+pid.offsetLeft+mmenuadjust;menuid.style.top=mposflag.offsetTop+mmenutable.offsetHeight+mmenuadjustV;
  155. if(mmenuitemwidth+parseInt(menuid.style.left)>document.body.clientWidth+document.body.scrollLeft)
  156. menuid.style.left=document.body.clientWidth+document.body.scrollLeft-mmenuitemwidth;
  157. menuid.style.visibility='visible';
  158. misShow=true;
  159. }
  160. function mshowsubmenu(menuid,pid,rid){
  161.  
  162. menuid.style.left=pid.offsetWidth+rid.offsetLeft;
  163. menuid.style.top=pid.offsetTop+rid.offsetTop-3;
  164. if(mmenuitemwidth+parseInt(menuid.style.left)>document.body.clientWidth+document.body.scrollLeft)
  165. menuid.style.left=document.body.clientWidth+document.body.scrollLeft-mmenuitemwidth;
  166. menuid.style.visibility='visible';
  167. }
  168. function mmenu_over(menuid,x){
  169. toel = getReal(window.event.toElement, "className", "coolButton");
  170. fromel = getReal(window.event.fromElement, "className", "coolButton");
  171. if (toel == fromel) return;
  172. if(x==5){
  173. misShow = false;
  174. mallhide();
  175. mtoout(eval("mMenu"+x));
  176. }else{
  177. if(!misShow){mtoout(eval("mMenu"+x));}else{
  178. mallhide();
  179. mtoin(eval("mMenu"+x));
  180. mmenushow(menuid,eval("mMenu"+x));
  181. }
  182. }
  183. clearTimeout(mpopTimer);
  184. }
  185. function mmenu_out(x){
  186. toel = getReal(window.event.toElement, "className", "coolButton");
  187. fromel = getReal(window.event.fromElement, "className", "coolButton");
  188. if (toel == fromel) return;
  189. if (misShow){
  190. mtoin(eval("mMenu"+x));
  191. }else{
  192. mnochange(eval("mMenu"+x));
  193. }
  194. mpopOut()
  195. }
  196. function mmenu_down(menuid,x){
  197. if(misShow){
  198. mmenuhide(menuid);
  199. mtoout(eval("mMenu"+x));
  200. }
  201. else{
  202. mtoin(eval("mMenu"+x));
  203. mmenushow(menuid,eval("mMenu"+x));
  204. misdown=true;
  205. }
  206. }
  207. function mmenu_up(){
  208. misdown=false;
  209. }
  210. function mmenuitem_over(menuid,item,x,j,i){
  211. toel = getReal(window.event.toElement, "className", "coolButton");
  212. fromel = getReal(window.event.fromElement, "className", "coolButton");
  213. if (toel == fromel) return;
  214. srcel = getReal(window.event.srcElement, "className", "coolButton");
  215. for(nummenu=1;nummenu<=mnumberofsub;nummenu++){
  216. var thesub=document.all['msubmenudiv'+nummenu]
  217. if(!(menuid==thesub||menuid.style.tag>=thesub.style.tag)){
  218. msubmenuhide(thesub);
  219. mnochange(document.all['mp'+nummenu]);
  220. document.all["mitem"+nummenu].style.color=mfontcolor;
  221. }
  222. }
  223. if(item)document.all["mitem"+item].style.color=mmenuovercolor;
  224. if(misdown||item){
  225. mtoin(srcel);
  226. }
  227. else{
  228. mtoout(srcel);
  229. }
  230. if(x==-1)mthestatus=eval("msub"+j).items[i].statustxt;
  231. if(j==-1)mthestatus=mmenus[x].items[i].statustxt;
  232. if(mthestatus!=""){
  233. musestatus=true;
  234. window.status=mthestatus;
  235. }
  236. clearTimeout(mpopTimer);
  237. }
  238. function mmenuitem_out(hassub){
  239. toel = getReal(window.event.toElement, "className", "coolButton");
  240. fromel = getReal(window.event.fromElement, "className", "coolButton");
  241. if (toel == fromel) return;
  242. srcel = getReal(window.event.srcElement, "className", "coolButton");
  243. if(!hassub)mnochange(srcel);
  244. if(musestatus)window.status="";
  245. mpopOut()
  246. }
  247. function mmenuitem_down(){
  248. srcel = getReal(window.event.srcElement, "className", "coolButton");
  249. mtoin(srcel)
  250. misdown=true;
  251. }
  252. function mmenuitem_up(){
  253. srcel = getReal(window.event.srcElement, "className", "coolButton");
  254. mtoout(srcel)
  255. misdown=false;
  256. }
  257. function mexec3(j,i){
  258. var cmd;
  259. if(eval("msub"+j).items[i].target=="blank"){
  260. cmd = "window.open('"+eval("msub"+j).items[i].command+"')";
  261. }else{
  262. cmd = eval("msub"+j).items[i].target+".location=\""+eval("msub"+j).items[i].command+"\"";
  263. }
  264. eval(cmd);
  265. }
  266. function mexec2(x){
  267. var cmd;
  268. if(mmenus[x].target=="blank"){
  269. cmd = "window.open('"+mmenus[x].command+"')";
  270. }else{
  271. cmd = mmenus[x].target+".location=\""+mmenus[x].command+"\"";
  272. }
  273. eval(cmd);
  274. }
  275. function mexec(x,i){
  276. var cmd;
  277. if(mmenus[x].items[i].target=="blank"){
  278. cmd = "window.open('"+mmenus[x].items[i].command+"')";
  279. }else{
  280. cmd = mmenus[x].items[i].target+".location=\""+mmenus[x].items[i].command+"\"";
  281. }
  282. eval(cmd);
  283. }
  284. function mbody_click(){
  285.  
  286. if (misShow){
  287. srcel = getReal(window.event.srcElement, "className", "coolButton");
  288. for(var x=0;x<=mmenus.length;x++){
  289. if(srcel.id=="mMenu"+x)
  290. return;
  291. }
  292. for(x=1;x<=mnumberofsub;x++){
  293. if(srcel.id=="mp"+x)
  294. return;
  295. }
  296. mallhide();
  297. }
  298. }
  299. document.onclick=mbody_click;
  300.  
  301. function mwritetodocument(){
  302. var mwb=1;
  303. var stringx='<div id="mposflag" style="position:absolute;"></div><table id=mmenutable border=0 cellpadding=3 cellspacing=2 width='+mmenuwidth+' height='+mmenuheight+' bgcolor='+mmenucolor+
  304. ' onselectstart="event.returnValue=false"'+
  305. ' style="cursor:'+mcursor+';'+mfonts+
  306. ' border-left: '+mwb+'px solid '+mmenuoutbordercolor+';'+
  307. ' border-right: '+mwb+'px solid '+mmenuinbordercolor+'; '+
  308. 'border-top: '+mwb+'px solid '+mmenuoutbordercolor+'; '+
  309. 'border-bottom: '+mwb+'px solid '+mmenuinbordercolor+'; padding:0px"><tr>'
  310. for(var x=0;x<mmenus.length;x++){
  311. var thismenu=mmenus[x];
  312. var imgsize="";
  313. if(thismenu.sizex!="0"||thismenu.sizey!="0")imgsize=" width="+thismenu.sizex+" height="+thismenu.sizey;
  314. var ifspace="";
  315. if(thismenu.caption!="")ifspace=" ";
  316. stringx += "<td nowrap class=coolButton id=mMenu"+x+" style='border: "+mitemedge+"px solid "+mmenucolor+
  317. "' width="+mmenuunitwidth+"px onmouseover=mmenu_over(mmenudiv"+x+
  318. //"' onmouseover=mmenu_over(mmenudiv"+x+
  319. ","+x+") onmouseout=mmenu_out("+x+
  320. ") onmousedown=mmenu_down(mmenudiv"+x+","+x+")";
  321. if(thismenu.command!=""){
  322. stringx += " onmouseup=mmenu_up();mexec2("+x+");";
  323. }else{
  324. stringx += " onmouseup=mmenu_up()";
  325. }
  326. if(thismenu.pos=="0"){
  327. stringx += " align=center><img align=absmiddle src='"+thismenu.img+"'"+imgsize+">"+ifspace+thismenu.caption+"</td>";
  328. }else if(thismenu.pos=="1"){
  329. stringx += " align=center>"+thismenu.caption+ifspace+"<img align=absmiddle src='"+thismenu.img+"'"+imgsize+"></td>";
  330. }else if(thismenu.pos=="2"){
  331. stringx += " align=center background='"+thismenu.img+"'> "+thismenu.caption+" </td>";
  332. }else{
  333. stringx += " align=center> "+thismenu.caption+" </td>";
  334. }
  335. stringx += "";
  336. }
  337. stringx+="<td width=*> </td></tr></table>";
  338.  
  339. for(var x=0;x<mmenus.length;x++){
  340. thismenu=mmenus[x];
  341. if(x==5){
  342. stringx+='<div id=mmenudiv'+x+' style="visiable:none"></div>';
  343. }else{
  344. stringx+='<div id=mmenudiv'+x+
  345. ' style="cursor:'+mcursor+';position:absolute;'+
  346. 'width:'+mmenuitemwidth+'px; z-index:'+(x+100);
  347. if(mmenuinbordercolor!=mmenuoutbordercolor&&msubedge=="0"){
  348. stringx+=';border-left: 1px solid '+mmidoutcolor+
  349. ';border-top: 1px solid '+mmidoutcolor;}
  350. stringx+=';border-right: 1px solid '+mmenuinbordercolor+
  351. ';border-bottom: 1px solid '+mmenuinbordercolor+';visibility:hidden" onselectstart="event.returnValue=false">\n'+
  352. '<table width="100%" border="0" height="100%" align="center" cellpadding="0" cellspacing="2" '+
  353. 'style="'+mfonts+' border-left: 1px solid '+mmenuoutbordercolor;
  354. if(mmenuinbordercolor!=mmenuoutbordercolor&&msubedge=="0"){
  355. stringx+=';border-right: 1px solid '+mmidincolor+
  356. ';border-bottom: 1px solid '+mmidincolor;}
  357. stringx+=';border-top: 1px solid '+mmenuoutbordercolor+
  358. ';padding: 4px" bgcolor='+mmenucolor+'>\n'
  359. for(var i=0;i<thismenu.items.length;i++){
  360. var thismenuitem=thismenu.items[i];
  361. var imgsize="";
  362. if(thismenuitem.sizex!="0"||thismenuitem.sizey!="0")imgsize=" width="+thismenuitem.sizex+" height="+thismenuitem.sizey;
  363. var ifspace="";
  364. if(thismenu.caption!="")ifspace=" ";
  365. if(thismenuitem.hasc!=null){
  366. stringx += "<tr><td id=mp"+thismenuitem.hasc+" class=coolButton style='border: "+mitemedge+"px solid "+mmenucolor+
  367. "' width=100% onmouseout=mmenuitem_out(true) onmouseover=\"mmenuitem_over(mmenudiv"+x+
  368. ",'"+thismenuitem.hasc+"',"+x+",-1,"+i+");mshowsubmenu(msubmenudiv"+thismenuitem.hasc+",mp"+thismenuitem.hasc+",mmenudiv"+x+");\""+
  369. "><table id=mitem"+thismenuitem.hasc+" cellspacing='0' cellpadding='0' border='0' width='100%' style='"+mfonts+"'><tr><td ";
  370. if(thismenuitem.pos=="0"){
  371. stringx += "><img align=absmiddle src='"+thismenuitem.img+"'"+imgsize+">"+ifspace+thismenuitem.caption+"</td><td";
  372. }else if(thismenuitem.pos=="1"){
  373. stringx += ">"+thismenuitem.caption+ifspace+"<img align=absmiddle src='"+thismenuitem.img+"'"+imgsize+"></td><td";
  374. }else if(thismenuitem.pos=="2"){
  375. stringx += "background='"+thismenuitem.img+"'>"+thismenuitem.caption+"</td><td background='"+thismenuitem.img+"'";
  376. }else{
  377. stringx += ">"+thismenuitem.caption+"</td><td";
  378. }
  379. stringx += " align=right width='1'><font face='Webdings' style='font-size: 6pt'>4</font></td></tr></table></td></tr>\n";
  380. }else if(!thismenuitem.isline){
  381. stringx += "<tr><td class=coolButton style='border: "+mitemedge+"px solid "+mmenucolor+
  382. "' width=100% height=15px onmouseover=\"mmenuitem_over(mmenudiv"+x+
  383. ",false,"+x+",-1,"+i+");\" onmouseout=mmenuitem_out() onmousedown=mmenuitem_down() onmouseup=";
  384. stringx += "mmenuitem_up();mexec("+x+","+i+"); ";
  385. if(thismenuitem.pos=="0"){
  386. stringx += "><img align=absmiddle src='"+thismenuitem.img+"'"+imgsize+">"+ifspace+thismenuitem.caption+"</td></tr>";
  387. }else if(thismenuitem.pos=="1"){
  388. stringx += ">"+thismenuitem.caption+ifspace+"<img align=absmiddle src='"+thismenuitem.img+"'"+imgsize+"></td></tr>";
  389. }else if(thismenuitem.pos=="2"){
  390. stringx += "background='"+thismenuitem.img+"'>"+thismenuitem.caption+"</td></tr>";
  391. }else{
  392. stringx += ">"+thismenuitem.caption+"</td></tr>";
  393. }
  394. }else{
  395. stringx+='<tr><td height="1" background="hr.gif" onmousemove="clearTimeout(mpopTimer);"><img height="1" width="1" src="none.gif" border="0"></td></tr>\n';
  396. }
  397. }stringx+='</table>\n</div>'
  398. }
  399. }
  400.  
  401. for(var j=1;j<=mnumberofsub;j++){
  402. thisitem=eval("msub"+j);
  403. stringx+='<div id=msubmenudiv'+j+
  404. ' style="tag:'+thisitem.level+';cursor:'+mcursor+';position:absolute;'+
  405. 'width:'+mmenuitemwidth+'px; z-index:'+(j+200);
  406. if(mmenuinbordercolor!=mmenuoutbordercolor&&msubedge=="0"){
  407. stringx+=';border-left: 1px solid '+mmidoutcolor+
  408. ';border-top: 1px solid '+mmidoutcolor;}
  409. stringx+=';border-right: 1px solid '+mmenuinbordercolor+
  410. ';border-bottom: 1px solid '+mmenuinbordercolor+';visibility:hidden" onselectstart="event.returnValue=false">\n'+
  411. '<table width="100%" border="0" height="100%" align="center" cellpadding="0" cellspacing="2" '+
  412. 'style="'+mfonts+' border-left: 1px solid '+mmenuoutbordercolor;
  413. if(mmenuinbordercolor!=mmenuoutbordercolor&&msubedge=="0"){
  414. stringx+=';border-right: 1px solid '+mmidincolor+
  415. ';border-bottom: 1px solid '+mmidincolor;}
  416. stringx+=';border-top: 1px solid '+mmenuoutbordercolor+
  417. ';padding: 4px" bgcolor='+mmenucolor+'>\n'
  418. for(var i=0;i<thisitem.items.length;i++){
  419. var thismenuitem=thisitem.items[i];
  420. var imgsize="";
  421. if(thismenuitem.sizex!="0"||thismenuitem.sizey!="0")imgsize=" width="+thismenuitem.sizex+" height="+thismenuitem.sizey;
  422. var ifspace="";
  423. if(thismenu.caption!="")ifspace=" ";
  424. if(thismenuitem.hasc!=null){
  425. stringx += "<tr><td id=mp"+thismenuitem.hasc+" class=coolButton style='border: "+mitemedge+"px solid "+mmenucolor+
  426. "' width=100% onmouseout=mmenuitem_out(true) onmouseover=\"mmenuitem_over(msubmenudiv"+j+
  427. ",'"+thismenuitem.hasc+"',-1,"+j+","+i+");mshowsubmenu(msubmenudiv"+thismenuitem.hasc+",mp"+thismenuitem.hasc+",msubmenudiv"+j+");\""+
  428. "><table id=mitem"+thismenuitem.hasc+" cellspacing='0' cellpadding='0' border='0' width='100%' style='"+mfonts+"'><tr><td ";
  429. if(thismenuitem.pos=="0"){
  430. stringx += "><img align=absmiddle src='"+thismenuitem.img+"'"+imgsize+">"+ifspace+thismenuitem.caption+"</td><td";
  431. }else if(thismenuitem.pos=="1"){
  432. stringx += ">"+thismenuitem.caption+ifspace+"<img align=absmiddle src='"+thismenuitem.img+"'"+imgsize+"></td><td";
  433. }else if(thismenuitem.pos=="2"){
  434. stringx += "background='"+thismenuitem.img+"'>"+thismenuitem.caption+"</td><td background='"+thismenuitem.img+"'";
  435. }else{
  436. stringx += ">"+thismenuitem.caption+"</td><td";
  437. }
  438. stringx += " align=right width='1'><font face='Webdings' style='font-size: 6pt'>4</font></td></tr></table></td></tr>\n";
  439. }else if(!thismenuitem.isline){
  440. stringx += "<tr><td class=coolButton style='border: "+mitemedge+"px solid "+mmenucolor+
  441. "' width=100% height=15px onmouseover=\"mmenuitem_over(msubmenudiv"+j+
  442. ",false,-1,"+j+","+i+");\" onmouseout=mmenuitem_out() onmousedown=mmenuitem_down() onmouseup=";
  443. stringx += "mmenuitem_up();mexec3("+j+","+i+"); ";
  444. if(thismenuitem.pos=="0"){
  445. stringx += "><img align=absmiddle src='"+thismenuitem.img+"'"+imgsize+">"+ifspace+thismenuitem.caption+"</td></tr>";
  446. }else if(thismenuitem.pos=="1"){
  447. stringx += ">"+thismenuitem.caption+ifspace+"<img align=absmiddle src='"+thismenuitem.img+"'"+imgsize+"></td></tr>";
  448. }else if(thismenuitem.pos=="2"){
  449. stringx += "background='"+thismenuitem.img+"'>"+thismenuitem.caption+"</td></tr>";
  450. }else{
  451. stringx += ">"+thismenuitem.caption+"</td></tr>";
  452. }
  453. }else{
  454. stringx+='<tr><td height="1" background="hr.gif" onmousemove="clearTimeout(mpopTimer);"><img height="1" width="1" src="none.gif" border="0"></td></tr>\n';
  455. }
  456. }
  457. stringx+='</table>\n</div>'
  458. }
  459. document.write("<div align='left'>"+stringx+"</div>");
  460. }
  461.  
  462. mpmenu=new mMenu('主菜单一','','self','','','','');
  463. mpmenu.addItem(new mMenuItem('主菜单一1','/index.asp','self',false,'说明文字',null,'','','',''));
  464. mpmenu.addItem(new mMenuItem('主菜单一2','/index.asp','self',false,'说明文字',null,'','','',''));
  465. mpmenu.addItem(new mMenuItem('主菜单一3','/index.asp','self',false,'说明文字',null,'','','',''));
  466.  
  467. mpmenu2=new mMenu('页元素','','self','','','','');
  468. msub1=new mMenuItem('设计文档','','self',false,'','1','','','','');
  469. msub1.addsubItem(new mMenuItem('设计文章','/notebook.asp','self',false,'说明文字',null,'','','',''));
  470. msub1.addsubItem(new mMenuItem('书籍下载','/notebook.asp','self',false,'说明文字',null,'','','',''));
  471. mpmenu2.addItem(msub1);
  472. msub2=new mMenuItem('网页特效','','self',false,'','1','','','','');
  473. msub2.addsubItem(new mMenuItem('网页特效1','/js.asp','self',false,'说明文字',null,'','','',''));
  474. msub2.addsubItem(new mMenuItem('网页特效2','/js.asp','self',false,'说明文字',null,'','','',''));
  475. msub2.addsubItem(new mMenuItem('网页特效3','/js.asp','self',false,'说明文字',null,'','','',''));
  476. msub2.addsubItem(new mMenuItem('网页特效4','/js.asp','self',false,'说明文字',null,'','','',''));
  477. msub2.addsubItem(new mMenuItem('网页特效5','/js.asp','self',false,'说明文字',null,'','','',''));
  478. mpmenu2.addItem(msub2);
  479. mpmenu2.addItem(new mMenuItem('精品收藏','/gallery.asp','self',false,'说明文字',null,'','','',''));
  480. mpmenu2.addItem(new mMenuItem('软件下载','/download.asp','self',false,'说明文字',null,'','','',''));
  481. mpmenu2.addItem(new mMenuItem('酷站推荐','/web.asp','self',false,'说明文字',null,'','','',''));
  482. mpmenu2.addItem(new mMenuItem('元素论坛','/forum/index.asp','self',false,'说明文字',null,'','','',''));
  483.  
  484. mpmenu=new mMenu('主菜单三','','self','','','','');
  485. mpmenu.addItem(new mMenuItem('主菜单三1','/index.asp','self',false,'说明文字',null,'','','',''));
  486. mpmenu.addItem(new mMenuItem('主菜单三2','/index.asp','self',false,'说明文字',null,'','','',''));
  487. mpmenu.addItem(new mMenuItem('主菜单三3','/index.asp','self',false,'说明文字',null,'','','',''));
  488. mpmenu.addItem(new mMenuItem('主菜单三4','/index.asp','self',false,'说明文字',null,'','','',''));
  489. mpmenu.addItem(new mMenuItem('主菜单三5','/index.asp','self',false,'说明文字',null,'','','',''));
  490.  
  491. mpmenu=new mMenu('主菜单四','','self','','','','');
  492. mpmenu.addItem(new mMenuItem('主菜单四1','/index.asp','self',false,'说明文字',null,'','','',''));
  493. mpmenu.addItem(new mMenuItem('主菜单四2','/index.asp','self',false,'说明文字',null,'','','',''));
  494. mpmenu.addItem(new mMenuItem('主菜单四3','/index.asp','self',false,'说明文字',null,'','','',''));
  495. mpmenu.addItem(new mMenuItem('主菜单四4','/index.asp','self',false,'说明文字',null,'','','',''));
  496. mpmenu.addItem(new mMenuItem('主菜单四5','/index.asp','self',false,'说明文字',null,'','','',''));
  497.  
  498. mpmenu=new mMenu('主菜单五','','self','','','','');
  499. msub3=new mMenuItem('主菜单五1','','self',false,'','1','','','','');
  500. msub3.addsubItem(new mMenuItem('主菜单五1-a','/index.asp','self',false,'说明文字',null,'','','',''));
  501. msub3.addsubItem(new mMenuItem('主菜单五1-b','/index.asp','self',false,'说明文字',null,'','','',''));
  502. msub3.addsubItem(new mMenuItem('主菜单五1-c','/index.asp','self',false,'说明文字',null,'','','',''));
  503. mpmenu.addItem(msub3);
  504. msub4=new mMenuItem('主菜单五2','','self',false,'','1','','','','');
  505. msub4.addsubItem(new mMenuItem('主菜单五2-a','/index.asp','self',false,'说明文字',null,'','','',''));
  506. msub4.addsubItem(new mMenuItem('主菜单五2-b','/index.asp','self',false,'说明文字',null,'','','',''));
  507. msub4.addsubItem(new mMenuItem('主菜单五2-c','/index.asp','self',false,'说明文字',null,'','','',''));
  508. mpmenu.addItem(msub4);
  509. msub5=new mMenuItem('主菜单五3','','self',false,'','1','','','','');
  510. msub5.addsubItem(new mMenuItem('主菜单五3-a','/index.asp','self',false,'说明文字',null,'','','',''));
  511. msub5.addsubItem(new mMenuItem('主菜单五3-b','/index.asp','self',false,'说明文字',null,'','','',''));
  512. msub5.addsubItem(new mMenuItem('主菜单五3-c','/index.asp','self',false,'说明文字',null,'','','',''));
  513.  
  514. msub3.addsubItem(new mMenuItem('主菜单五3-d','/index.asp','self',false,'说明文字',null,'','','',''));
  515. msub4.addsubItem(new mMenuItem('主菜单五4-d','/index.asp','self',false,'说明文字',null,'','','',''));
  516. msub5.addsubItem(new mMenuItem('主菜单五5-d','/index.asp','self',false,'说明文字',null,'','','',''));
  517. /*
  518. mpmenu.addItem(msub5);
  519. mpmenu6=new mMenu('返回主页','/index.asp','self','','','','');
  520. mpmenu7=new mMenu('访问论坛','/forum/index.asp','self','','','','');*/
  521. mwritetodocument();
  522. </script>
  523.  
  524.  

js实现网站导航的二级下拉菜单的更多相关文章

  1. HTML+CSS实现导航栏二级下拉菜单完整代码

    工具是vs code 代码如下 <!DOCTYPE html> <html lang="en"> <head> <meta charset ...

  2. CSS技巧分享:如何用css制作横排二级下拉菜单

    原文:CSS技巧分享:如何用css制作横排二级下拉菜单 导航菜单是每个网站所必备的功能,也是每个学习制作网站的朋友所必须接触的,如何用css样式制作一个简单漂亮的二级下拉菜单呢,下来小编就一步一步教大 ...

  3. Bootstrap历练实例:导航内的下拉菜单

    <!DOCTYPE html><html><head><meta http-equiv="Content-Type" content=&q ...

  4. 纯CSS3实现宽屏二级下拉菜单

    今天我们要来分享一款基于纯CSS3的宽屏二级下拉菜单,这款菜单的子菜单在展开的时候是很宽敞的,菜单项中可以自定义格式的内容,非常实用,也很大气.由于是用纯CSS3实现,所以这款下拉菜单不用运行Java ...

  5. CSS 笔记——导航栏、下拉菜单、提示工具

    8. 导航栏.下拉菜单.提示工具 (1)导航栏 垂直导航栏 <!DOCTYPE html> <html lang="en"> <head> &l ...

  6. flash滚动图片遮住二级下拉菜单解决方法

    如上图所示,在进行排版时,如果不注意会遇到二级下拉菜单被下边的img图片遮住.此种情况在ie7 8 中出现. 解决方法:给二级下拉菜单添加z-index:9999;position:relative; ...

  7. Excel应用----制作二级下拉菜单【转】

    应用: 原始数据源是两列的源数据,那该如何制作二级下拉菜单, 当然可以将这两列的数据源,转换成上面的那种格式,再用上面的方法来制作. 今天教大学的方法是直接通过这种两列式的数据源来制作下拉菜单,如果A ...

  8. boostrapt的二级下拉菜单

    <!DOCTYPE html><html> <head> <meta charset="UTF-8"> <meta conte ...

  9. dede调用二级下拉菜单方法

    <div id="menu">    <ul>  {dede:channelartlist typeid='top'  row='6' orderby='s ...

随机推荐

  1. Unity3D 200个插件免费分享

    插件清单: 2D_Toolkit_1.51     动画开发插件包 FingerGestures           触摸插件 ORK_Okashi_RPG_Kit       Unity3D角色扮演 ...

  2. CSS圆角,输入框提示信息,JS查找同级元素

    input { /*设置边框*/ border:1px solid #95B8E7; border-radius: 5px; /*设置圆角,IE不兼容*/ height:18px } placehol ...

  3. F5 会话保持

    1.什么是会话保持?在大多数电子商务的应用系统或者需要进行用户身份认证的在线系统中,一个客户与服务器经常经过好几次的交互过程才能完成一笔交易或者是一个请求的完成.由于这几次交互过程是密切相关的,服务器 ...

  4. C:内存分配、内存中五大区

     1.内存的划分  (从高到低依次是: 栈区 . 堆区 .全局静态区 . 常量区 . 代码区 )栈区是系统自动回收,堆区是我们手动回收  2. 栈区   在函数内部定义的局部变量和数组.都存放在栈区, ...

  5. Oracle Job相关

    Oracle JOB的建立,定时执行任务      begin            sys.dbms_job.submit(job => :job,                       ...

  6. 工作一直没有进步怎么办?试试PDCA法则吧!

    许多人在工作或者学习的时候,总是会发现自己过了一段时间以后,全然没有不论什么进步.或者进步很之少. 而对于每个渴望让自己变得更好的人来说.是一件很令人苦恼的事情,今天我们就来谈一下工作和学习上,可实现 ...

  7. 巧妙使用Jquery 改变元素的 onclick 事件

    需要点击图片将套组发布, 页面代码: <img width="20px" src=" <s:property value="IMAGES_PATH& ...

  8. C# udpclient 发送数据断网后自动连接的方法

    需求 有一个winform程序, 用来调试路由器和对路由器吞吐量进行测试 需要后台不断的接收来自udp服务器端的数据,同时要发送数据到服务器端(无线路由器) 设计时候,通过一个线程,for(;;)死循 ...

  9. js 获取cookie

      <!DOCTYPE html>   <html xmlns="http://www.w3.org/1999/xhtml">       <head ...

  10. 使用NuGet安装EntityFramework4.2

    1.下载NuGet 有两种方式下载NuGet 第一种:在微软的档案库下载,下载地址为:http://visualstudiogallery.msdn.microsoft.com/27077b70-9d ...