How to Implement the left-right key menu on the control placed on the Asp.net page and operate on it at the same time (2)

Source: Internet
Author: User
Csdn-document center-. net
Title How to Implement the left-right key menu on the control placed on the Asp.net page and operate on it at the same time (2)Lyx123 (original)
Keywords Asp.net, right-click the menu


As mentioned above, the menu has been created. Now I want to talk about the second part:

(2) Select the menu and click the menu

Select the mousemove and click events of the mouse when the menu is actually clicked. In the menustyle mentioned above, I implemented the pop-up menu through the window. createpopup function provided by JavaScript. the pop-up menu content is a table. Each item in the table provides the mousemove and click events.

When the mousemove event occurs, I show him different styles.

When a click event occurs, call the fnclick function to enable the required task. Now we will introduce the menustyle () function in detail.

Function menustyle (){

If (window. navigator. appname = "Microsoft Internet Explorer" & window. navigator. appversion. substring (window. navigator. appversion. indexof ("MSIE") + 5, window. navigator. appversion. indexof ("MSIE") + 8)> = 5.5)

Isie = 1;

Else

Isie = 0;

If (isie ){

Menucontent = '<Table id = "rightmenu" width = "0" Height = "0" cellspacing = "0" cellpadding = "0" style = "Font: menu; color: menutext; "> <tr Height =" 1 "> <TD style =" Background: black "colspan =" 4 "> </TD> </tr> <tr Height =" 10 "> <TD style =" Background: black "> </TD> <TD style =" Background: snow "> <Table cellspacing =" 0 "cellpadding =" 0 "nowrap style =" Font: menu; color: menutext; cursor: default; "> '; // This row draws a table. from below, add the project in the table and provide the MO Useover. The most important thing is that the function called by the onclick event is parent. fnclickmenu. Note that the function of the parent window is called.

For (m = 0; m <menuitems. length; m ++ ){

If (menuitems [m] [0] & menuitems [m] [2])

Menucontent + = '<tr Height = "17" onmouseover = "this. style. background =/'# 9999cc/'; this. style. color =/'menutext/'; "onmouseout =" this. style. background =/'snow/'; this. style. color =/'menutext/'; "onclick =" parent. fnclickmenu (/''+ menuitems [m] [1] + '/')" <TD style = "Background: threedface "width =" 1 "nowrap> </TD> <TD width =" 21 "nowrap> </TD> <TD nowrap> '+ menuitems [m] [0] +' </TD> <TD width = "21" nowrap> </TD> <TD style = "Background: threedface "width =" 1 "nowrap> </TD> </tr> ';

Else if (menuitems [m] [0])

Menucontent + = '<tr Height = "17" onmouseover = "this. style. background =/'# 9999cc/'; this. style. color =/'menutext/'; "onmouseout =" this. style. background =/'snow/'; this. style. color =/'menutext/'; "onclick =" parent. fnclickmenu (/''+ menuitems [m] [1] + '/')"> <TD style = "Background: threedface "width =" 1 "nowrap> </TD> <TD width =" 21 "nowrap> </TD> <TD nowrap> '+ menuitems [m] [0] + '</TD> <TD width = "21" nowrap> </TD> <TD style = "Background: threedface "width =" 1 "nowrap> </TD> </tr> ';

Else

Menucontent + = '<tr> <TD colspan = "5" Height = "4"> </TD> </tr> <TD colspan = "5"> <table cellspacing = "0"> <tr> <TD width = "2" Height = "1"> </TD> <TD width = "0" Height = "1" Style = "Background: threedshadow "> </TD> <TD width =" 2 "Height =" 1 "> </TD> </tr> <TD width =" 2 "Height = "1"> </TD> <TD width = "100%" Height = "1" style = "Background: threedhighlight "> </TD> <TD width =" 2 "Height =" 1 "> </TD> </tr> </table> </TD> </tr> <tr> <TD colspan = "5" Height = "3"> </TD> </tr> ';

}

Menucontent + = '</table> </TD> <TD style = "Background: threedshadow"> </TD> <TD style = "Background: threeddarkshadow "> </TD> </tr> <tr Height =" 1 "> <TD style =" Background: threedlightshadow "> </TD> <TD style =" Background: threedhighlight "> </TD> <TD style =" Background: threedface "> </TD> <TD style =" Background: threedshadow "> </TD> <TD style =" Background: threeddarkshadow "> </TD> </tr> <tr Height =" 1 "> <TD style =" Background: threedlightshadow "> </TD> <TD style =" Background: threedshadow "colspan =" 3 "> </TD> <TD style =" Background: threeddarkshadow "> </TD> </tr> <tr Height =" 1 "> <TD style =" Background: threeddarkshadow "colspan =" 5 "> </TD> </tr> </table> ';

// A menu is displayed below.

Menupopup = Window. createpopup ();

// The items in the menu are shown in the table above.

Menupopup.doc ument. Body. innerhtml = menucontent;

Combining the showmenu () and function above, we can understand how to implement the pop-up menu function. In the fnclickmenu function. You can easily add various features you want to handle.

You may want to communicate with me if you do not understand it. Email: l_yx123@sina.com.cn

Related Article

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.