JavaScript context menu effect code

Source: Internet
Author: User

Set the following Code Add to ----------------------------------

<Script language = 'javascript '>
***************/
VaR mname = new array (
"First page ",
"Repair and modification ",
"Downlink ",
"Delete ",
"New ",
"Refresh"
);
// Mname is the name corresponding to the menu, and the number of arrays must correspond to the following murl

VaR murl = new array (
"Window. Open ('HTTP: // www.cn5.cn ',' _ blank ','');",
"Alert ('modify ');",
"Alert ('Download ');",
"Alert ('delete ');",
"Alert ('new ');",
"Alert ('refresh ');"
);
// Murl is the operation corresponding to the menu. It can be any JavaScript code, but be careful not to enter \ "in it. You can only use'
// Window. Location = 'url ';
VaR pH = 18, mwidth = 50; // The height of each option, total menu width
VaR BGC = "# Eee", txc = "black"; // No selected background color or text color
VaR cbgc = "darkblue", ctxc = "white"; // the background color and text color of the selected menu

/**************** Do not modify the following code ******************/
VaR mover = "This. style. Background = '" + cbgc + "'; this. style. Color = '" + ctxc + "';"
VaR mout = "This. style. Background = '" + BGC + "'; this. style. Color = '" + txc + "';"

Document. oncontextmenu = function ()
{
Mlay. style. Display = "";
Mlay. style. pixeltop = event. clienty;
Mlay. style. pixelleft = event. clientx;
Return false;
}
Function showoff ()
{
Mlay. style. Display = "NONE ";
}

function fresh ()
{< br> mlay. style. background = BGC;
mlay. style. color = txc;
mlay. style. width = mwidth;
mlay. style. height = mname. length * pH;
var H = "



{< br> H + = "
"; var I = 0; for (I = 0; I "; }< br> H + ="
"+ mname [I] +"
";
mlay. innerhtml = H;
}< br>

--------------------------------
Replace the tag
labels

--------------------------------
Insert the following code between and
----------------------------------


--------------------------------
Complete !!!

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.