Right-click menu similar to Windows Start Menu

Source: Internet
Author: User
Tags microsoft frontpage

The Code is as follows:


<HTML> <HEAD> <TITLE> right-click menu </TITLE> <br/> <META content = "text/html; charset = gb2312 "http-equiv = Content-Type> <br/> <STYLE type = text/css> BODY {<br/> FONT-SIZE: 12px; <br/>}< br/>. info {FONT-SIZE: 14px; color: # FFFFFF; font-family: @ Tahoma, @; width: 20px} <br/> TABLE {<br/> CURSOR: default; FONT-SIZE: 12px; MARGIN: 0px <br/>}< br/> TR {<br/> HEIGHT: 20px <br/>}< br/> TR. over {<br/> BACKGROUND-COLOR: #000080; COLOR: # Ffffff; CURSOR: default; FONT-SIZE: 12px <br/>}< br/> TR. out {<br/> BACKGROUND-COLOR: # efefef; COLOR: #000000; FONT-SIZE: 12px <br/>}< br/> DIV. rm_div {<br/> BACKGROUND-COLOR: # efefef; BORDER-BOTTOM: # ffffff 1px outset; BORDER-LEFT: # ffffff 1px outset; BORDER-RIGHT: # ffffff 1px outset; BORDER-TOP: # ffffff 1px outset; DISPLAY: none; FILTER: Alpha (Opacity = '95 '); HEIGHT: 0px; PADDING-BOTTOM: 1px; PA DDING-LEFT: 1px; PADDING-RIGHT: 1px; PADDING-TOP: 1px; POSITION: absolute; WIDTH: 0px <br/>}< br/> HR. sperator {<br/> BORDER-BOTTOM: # ffffff 1px inset; BORDER-LEFT: # ffffff 1px inset; BORDER-RIGHT: # ffffff 1px inset; BORDER-TOP: # ffffff 1px inset; WIDTH: 95% <br/>}< br/>. w2kfont {<br/> FONT-FAMILY: Tahoma; FONT-SIZE: 8pt <br/>}< br/> </STYLE> </p> <SCRIPT language = JScript> <br/> <! -- <Br/> function RightMenu () <br/>{< br/> this. addExtendMenu = AddExtendMenu; <br/> this. addItem = AddItem; <br/> this. getMenu = GetMenu; <br/> this. hideAll = HideAll; <br/> this. I _OnMouseOver = I _OnMouseOver; <br/> this. I _OnMouseOut = I _OnMouseOut; <br/> this. I _OnMouseUp = I _OnMouseUp; <br/> this. p_OnMouseOver = P_OnMouseOver; <br/> this. p_OnMouseOut = P_OnMouseOut; <br/> A_rbpm = new Array (); <br/> HTMLstr = ""; <Br/> HTMLstr + = "<! -- RightButton PopMenu --> \ n "; <br/> HTMLstr + =" \ n "; <br/> HTMLstr + =" <! -- PopMenu Starts --> \ n "; <br/> HTMLstr + =" <div id = 'e _ rbpm 'class = 'rm _ div'> \ n "; <br/> // rbpm = right button pop menu <br/> HTMLstr + = "<table width = '000000' border = '0' cellspacing = '0'> \ n "; <br/> HTMLstr + = "<tr> <td height = '000000' width = '20' valign = 'bottom 'bgcolor = '#264 'onclick = window. event. cancelBubble = true; class = info> XX production <br >:< br> XX website \ n "; <br/> HTMLstr + = "</td> <td height = '000000' width = '000000' sty Le = 'padding: 1 'valign = 'bottom'> \ n "; <br/> HTMLstr + = "<table width = '000000' border = '0' cellspacing = '0'> \ n"; <br/> HTMLstr + = "<! -- Insert A Extend Menu or Item On Here For E_rbpm --> \ n "; <br/> HTMLstr + = "</table> </td> </tr> </table> \ n "; <br/> HTMLstr + = "</div> \ n"; <br/> HTMLstr + = "<! -- Insert A Extend_Menu Area on Here For E_rbpm --> "; <br/> HTMLstr + =" \ n "; <br/> HTMLstr + =" <! -- PopMenu Ends --> \ n "; <br/>}< br/> function AddExtendMenu (id, img, wh, name, parent) <br/>{< br/> var TempStr = ""; </p> <p> eval ("A _" + parent + ". length + + "); <br/> eval (" A _ "+ parent +" [A _ "+ parent + ". length-1] = id "); // register this item to the ID array of the parent menu item <br/> TempStr + = "<div id = 'e _" + id + "'class = 'rm _ div '> \ n "; <br/> TempStr + = "<table width = '000000' border = '0' cellspacing = '0'> \ n"; <br/> TempStr + = "<! -- Insert A Extend Menu or Item On Here For E _ "+ id +" --> "; <br/> TempStr + =" </table> \ n "; <br/> TempStr + = "</div> \ n"; <br/> TempStr + = "<! -- Insert A Extend_Menu Area on Here For E _ "+ id +" --> "; <br/> TempStr + =" <! -- Insert A Extend_Menu Area on Here For E _ "+ parent +" --> "; <br/> HTMLstr = HTMLstr. replace (" <! -- Insert A Extend_Menu Area on Here For E _ "+ parent +" --> ", TempStr ); </p> <p> eval ("A _" + id + "= new Array ()"); <br/> TempStr = ""; <br/> TempStr + = "<! -- Extend Item: P _ "+ id +" --> \ n "; <br/> TempStr + = "<tr id = 'P _" + id + "'class = 'out '"; <br/> TempStr + = "onmouseover = 'P _ OnMouseOver (\" "+ id +" \ ", \" "+ parent + "\")'"; <br/> TempStr + = "onmouseout = 'P _ OnMouseOut (\" "+ id +" \ ", \" "+ parent + "\")'"; <br/> TempStr + = "onmouseup = window. event. cancelBubble = true; "; <br/> TempStr + =" onclick = window. event. cancelBubble = true; "; <br/> TempStr + ="> <td nowrap> "; <br/> Temp Str + = "<font face = 'wingdings 'style = 'font-size: 18px '> 0 </font> & nbsp;" + name + "& nbsp; & nbsp </td> <td style = 'font-family: webdings; text-align:; '> 4 "; <br/> TempStr + = "</td> </tr> \ n"; <br/> TempStr + = "<! -- Insert A Extend Menu or Item On Here For E _ "+ parent +" --> "; <br/> HTMLstr = HTMLstr. replace (" <! -- Insert A Extend Menu or Item On Here For E _ "+ parent +" --> ", TempStr); <br/>}< br/> function AddItem (id, img, wh, name, parent, location) <br/>{< br/> var TempStr = ""; <br/> var ItemStr = "<! -- ITEM: I _ "+ id +" --> "; <br/> if (id =" sperator ") <br/>{< br/> TempStr + = ItemStr + "\ n"; <br/> TempStr + = "<tr class = 'out' onclick = 'window. event. cancelBubble = true; 'onmouseup = 'window. event. cancelBubble = true; '> <td colspan = '2' height = '1'> <pr class = 'sperator'> </td> </tr> "; <br/> TempStr + = "<! -- Insert A Extend Menu or Item On Here For E _ "+ parent +" --> "; <br/> HTMLstr = HTMLstr. replace (" <! -- Insert A Extend Menu or Item On Here For E _ "+ parent +" --> ", TempStr); <br/> return; <br/>}< br/> if (HTMLstr. indexOf (ItemStr )! =-1) <br/>{< br/> alert ("I _" + id + "already exist! "); <Br/> return; <br/>}< br/> TempStr + = ItemStr +" \ n "; <br/> TempStr + = "<tr id = 'I _" + id + "'class = 'out '"; <br/> TempStr + = "onmouseover = 'I _ OnMouseOver (\" "+ id +" \ ", \" + parent + "\")'"; <br/> TempStr + = "onmouseout = 'I _ OnMouseOut (\" "+ id + "\")'"; <br/> TempStr + = "onclick = 'window. event. cancelBubble = true; '"; <br/> if (location = null) <br/> TempStr + = "onmouseup = 'I _ OnMouseUp (\" "+ id +" \ ", \" "+ parent +" \ ", n Ull) '"; <br/> else <br/> TempStr + =" onmouseup =' I _ OnMouseUp (\ "" + id + "\", \ "" + parent + "\", \ "" + location + "\") '"; <br/> TempStr + ="> <td nowrap> "; <br/> TempStr + = "<font face = 'wingdings 'style = 'font-size: 18px'>" + wh + "</font> & nbsp; "+ name +" & nbsp; "; <br/> TempStr + =" </td> </tr> \ n "; <br/> TempStr + = "<! -- Insert A Extend Menu or Item On Here For E _ "+ parent +" --> "; <br/> HTMLstr = HTMLstr. replace (" <! -- Insert A Extend Menu or Item On Here For E _ "+ parent +" --> ", TempStr); <br/>}< br/> function GetMenu () <br/>{< br/> return HTMLstr; <br/>}< br/> function I _OnMouseOver (id, parent) <br/>{< br/> var Item; <br/> if (parent! = "Rbpm") <br/>{< br/> var ParentItem; <br/> ParentItem = eval ("P _" + parent); <br/> ParentItem. className = "over"; <br/>}< br/> Item = eval ("I _" + id); <br/> Item. className = "over"; <br/> HideAll (parent, 1); <br/>}< br/> function I _OnMouseOut (id) <br/>{< br/> var Item; <br/> Item = eval ("I _" + id); <br/> Item. className = "out"; <br/>}< br/> function I _OnMouseUp (id, parent, location) <br/>{< br/> var Paren TMenu; <br/> window. event. cancelBubble = true; <br/> OnClick (); <br/> ParentMenu = eval ("E _" + parent); <br/> ParentMenu. display = "none"; <br/> if (location = null) <br/> eval ("Do _" + id + "()"); <br/> else <br/> window. open (location); <br/>}< br/> function P_OnMouseOver (id, parent) <br/>{< br/> var Item; <br/> var Extend; <br/> var Parent; <br/> if (parent! = "Rbpm") <br/>{< br/> var ParentItem; <br/> ParentItem = eval ("P _" + parent); <br/> ParentItem. className = "over"; <br/>}< br/> HideAll (parent, 1); <br/> Item = eval ("P _" + id ); <br/> Extend = eval ("E _" + id); <br/> Parent = eval ("E _" + parent); <br/> Item. className = "over"; <br/> Extend. style. display = "block"; <br/> Extend. style. posLeft = document. body. scrollLeft + Parent. offsetLeft + Parent. offsetWidth-4 <br/> If (Extend. style. posLeft + Extend. offsetWidth> document. body. scrollLeft + document. body. clientWidth) <br/> Extend. style. posLeft = Extend. style. posLeft-Parent.offsetWidth-Extend.offsetWidth + 8; <br/> if (Extend. style. posLeft <0) Extend. style. posLeft = document. body. scrollLeft + Parent. offsetLeft + Parent. offsetWidth; <br/> Extend. style. posTop = Parent. offsetTop + Item. offsetTop + 1; <br/> if (Extend. style. posTop + Exten D. offsetHeight> document. body. scrollTop + document. body. clientHeight) <br/> Extend. style. posTop = document. body. scrollTop + document. body. clientHeight-Extend.offsetHeight; <br/> if (Extend. style. posTop <0) Extend. style. posTop = 0; <br/>}< br/> function P_OnMouseOut (id, parent) <br/>{< br/>}< br/> function HideAll (id, flag) <br/>{< br/> var Area; <br/> var Temp; <br/> var I; <br/> if (! Flag) <br/>{< br/> Temp = eval ("E _" + id); <br/> Temp. style. display = "none"; <br/>}< br/> Area = eval ("A _" + id); <br/> if (Area. length) <br/> {<br/> for (I = 0; I <Area. length; I ++) <br/>{< br/> HideAll (Area [I], 0 ); <br/> Temp = eval ("E _" + Area [I]); <br/> Temp. style. display = "none"; <br/> Temp = eval ("P _" + Area [I]); <br/> Temp. className = "out"; <br/>}</p> <p> document. onmouseup = OnMouseUp; <B R/> document. onclick = OnClick; <br/> function OnMouseUp () <br/> {<br/> if (window. event. button = 2) <br/>{< br/> var PopMenu; <br/> PopMenu = eval ("E_rbpm"); <br/> HideAll ("rbpm ", 0); <br/> PopMenu. style. display = "block"; <br/> PopMenu. style. posLeft = document. body. scrollLeft + window. event. clientX; <br/> PopMenu. style. posTop = document. body. scrollTop + window. event. clientY; <br/> if (PopMenu. style. posLeft + PopMenu. offsetWidth> document. body. scrollLeft + document. body. clientWidth) <br/> PopMenu. style. posLeft = document. body. scrollLeft + document. body. clientWidth-PopMenu.offsetWidth; <br/> if (PopMenu. style. posLeft <0) PopMenu. style. posLeft = 0; <br/> if (PopMenu. style. posTop + PopMenu. offsetHeight> document. body. scrollTop + document. body. clientHeight) <br/> PopMenu. style. posTop = document. body. scrollTop + document. Body. clientHeight-PopMenu.offsetHeight; <br/> if (PopMenu. style. posTop <0) PopMenu. style. posTop = 0; <br/>}< br/> function OnClick () <br/>{< br/> HideAll ("rbpm", 0 ); <br/>}< br/> // Add Your Function on following <br/> function Do_viewcode () {window. location = "view-source:" + window. location. href ;}< br/> function Do_help () {window. showHelp (window. location) ;}< br/> function Do_exit () {window. cl Ose () ;}< br/> function Do_refresh () {window. location. reload () ;}< br/> function Do_back () {history. back () ;}< br/> function Do_forward () {history. forward () ;}< br/> function Do_help () {<br/> var s_help = '<style> body, td {font: menu; padding: 2} </style> '; <br/> s_help + =' <title> help-www.51windows. net </title> '; <br/> s_help + =' <body bgcolor = menu> '; <br/> s_help + =' <br> welcome to the carefree window! This system is similar to your Windows operating system. Click Start to open the Start menu, and double-click the desktop icon to open the relevant files! <Span style = "color: blue; cursor: hand" onclick = showHelp ("windows. chm:/MS-ITS: ntdef. chm:/default.htm ")> local help .. </span> '; <br/> showModalDialog ("about:" + s_help + "", "", "dialogHeight: 110px; dialogWidth: 210px; help: yes; status: no ")} <br/> --> <br/> </SCRIPT> </p> <META content = "MSHTML 5.00.2920.0" name = GENERATOR> </HEAD> <br/> <BODY bgColor = #336699 oncontextmenu = window. event. returnValue = false> <br/> <DIV id = snwc Wt> & nbsp; right-click </DIV> <br/> <SCRIPT language = JScript> <br/> <! -- <Br/> var menu = new RightMenu (); <br/> menu. addItem ("update", "start_update", "4", "<font class = w2kfont> Web Update </font>", "rbpm", "http: // "); <br/> menu. addItem ("suan", "suan", "a", "", "rbpm", "http: //"); <br/> menu. addItem ("sperator", "", "rbpm", null); <br/> menu. addExtendMenu ("program", "start_pro", "24", "program <font class = w2kfont> (<u> P </u>) </font> ", "rbpm", null); <br/> menu. addExtendMenu ("p_acc", "folder", "+", "attachment", "program", null); <br/> menu. addItem ("p_acc1", "html", "+", "<font class = w2kfont> Microsoft FrontPage 2000 </font>", "program ", "51 w/game/"); <br/> menu. addItem ("p_acc2", "html", "+", "<font class = w2kfont> Norton AntiVirus illegal ate Edition </font>", "program", "http: // "); <br/> menu. addExtendMenu ("p_lgame", "folder", "16", "games", "p_acc", null); <br/> menu. addItem ("p_game1", "folder", "+", "", "p_lgame", "51 w/game/"); <br/> menu. addItem ("p_game2", "folder", "+", "Super horsepower", "p_lgame", "51 w/game/"); <br/> menu. addItem ("p_game3", "folder", "+", "wuziqi", "p_lgame", "51 w/game/"); <br/> menu. addItem ("p_game4", "folder", "+", "Tetris", "p_lgame", "51 w/game/"); <br/> menu. addExtendMenu ("doc", "start_doc", "24", "document <font class = w2kfont> (<u> D </u>) </font> ", "rbpm", null); <br/> menu. addItem ("d_photo", "folder", "+", "My Stamps", "doc", null); <br/> menu. addExtendMenu ("fav", "start_fav", "24", "add to favorites <font class = w2kfont> (<u> A </u>) </font> ", "rbpm", null); <br/> menu. addExtendMenu ("f_bbs", "folder", "16", "Forum", "fav", null); <br/> menu. addItem ("f_bbs1", "html", "+", "Blue ideal", "f_bbs", "http://www.blueidea.com/bbs/"); <br/> menu. addItem ("f_bbs2", "html", "+", "Carefree script", "f_bbs", "http://www.51js.com/"); <br/> menu. addItem ("f_bbs3", "html", "+", "CSDN Expert Clinic", "f_bbs", "http://www.csdn.net/Expert/"); <br/> menu. addItem ("f_bbs4", "html", "+", "Hong En online communication", "f_bbs", "http: //"); <br/> menu. addExtendMenu ("f_webpage", "folder", "16", "webpage creation", "fav", null); <br/> menu. addItem ("f_webpage1", "html", "", "<font disabled> (null) </font>", "f_webpage", "http ://"); <br/> menu. addExtendMenu ("f_study", "folder", "16", "Online Learning", "fav", null); <br/> menu. addItem ("f_s1", "html", "", "<font disabled> (null) </font>", "f_study", "http://matrix.hongen.com/forum "); <br/> menu. addExtendMenu ("f_link", "folder", "16", "Link", "fav", null); <br/> menu. addItem ("f_link1", "html", "+", "worry-free windows", "f_link", "http://www.51windows.com"); <br/> menu. addExtendMenu ("setting", "start_set", "24", "set <font class = w2kfont> (<u> S </u>) </font> ", "rbpm", null); <br/> menu. addItem ("s_panel", "folder", "+", "Control Panel (C)", "setting", "http: //"); <br/> menu. addItem ("sperator", "", "setting", null); <br/> menu. addItem ("s_data", "s_user", "+", "user information (D)", "setting", "http: //"); <br/> menu. addItem ("s_display1", "s_taskbar", "+", "Taskbar and start menu (T)", "setting", "http ://"); <br/> menu. addExtendMenu ("find", "start_find", "24", "Search <font class = w2kfont> (<u> F </u>)", "rbpm ", null); <br/> menu. addItem ("l_search", "search", "4", "file or folder (<u> F </u> )... "," find "," http: // "); <br/> menu. addItem ("I _search", "esearch", "4", "on the Internet (<u> I </u> )... "," find "," http: // "); <br/> menu. addItem ("u_search", "f_user", "4", "user (<u> P </u> )... "," find "," http: // "); <br/> menu. addItem ("help", "start_help", "V", "& nbsp; help <font class = w2kfont> (<u> H </u>) </font> "," rbpm ", null); <br/> menu. addItem ("sperator", "", "rbpm", null); <br/> menu. addItem ("logoff", "start_logoff", "v", "& nbsp; logout <font class = w2kfont> (<u> L </u>) </font> "," rbpm ", null); <br/> menu. addItem ("shut", "start_shut", "x", "Exit <font class = w2kfont> (<u> U </u>) </font> ", "rbpm", null); <br/> document. writeln (menu. getMenu ()); <br/> --> <br/> </SCRIPT> <br/> </TD> </TR> </TABLE> </BODY> </HTML>
[Ctrl + A select all prompt: you can modify part of the code first, then click to run the Code]

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.