Implement the right key shortcut menu on a Web page

Source: Internet
Author: User
web| Menu | page |-Right

Style code:

<style type= "Text/css" >
Body{font:9pt "Song body"; margintop:0px; color:red background: #ffffff}
a.{font:9pt "song body"; cursor:hand; font-size:9pt; color:blue; Text-decoration:none}
a:active{font:9pt "song body"; Cursor:hand color: #FF0033}
a.cc:hover{font:9pt "song body"; Cursor:hand color: #FF0033}
. box{font:9pt "song Body"; Position:absolute Background:lightgrey;}
</style>

The HTML code is as follows:

<table id= "Itemopen" class= "box" style= "Display:none" >
<tr>
<td> pop-up menu </td>
</tr>
<tr>
<td><a href= "http://blog.csdn.net/Erickson/"class=" CC ">erickson's column </a></td>
</tr>
<tr>
<td><a href= "http://www.csdn.net"class=" CC >CSDN</a></td>
</tr>
<tr>
<td><a href= "http://www.google.com"class= cc" >google search </a></td>
</tr>
<tr>
<td><a href= "http://www.sohu.com"class=" CC > Sohu </a></td>
</tr>
<tr>
<td><a href= "http://www.yahoo.com"class=" CC >Yahoo</a></td>
</tr>
<tr>
<td><a href= "http://www.163.com"class= cc" >163 website </a></td>
</tr>
<tr>
<td><a href= "http://sports.sina.com.cn"class=" CC > Sina sports </a></td>
</tr>
</table>

Scripting code:

Right-click the mouse to display the shortcut menu:
<script language= "JavaScript" >
Document.onmousedown = function popUp () {
menu = Document.all.itemopen
if (Event.button = = 2) {
NEWX = Window.event.x + document.body.scrollLeft
Newy = Window.event.y + document.body.scrollTop
Menu.style.display = ""
Menu.style.pixelLeft = newx
Menu.style.pixelTop = Newy
}
else if (Event.button = 1)
{
Menu.style.display = "None"
}
}
</script>

screen IE default WinForm shortcut menu:
<script language= "JavaScript" >
var message= "";
function Clickie ()
{
if (document.all)
{
(message);
return false;
}
}
function Clickns (e)
{
if (document.layers| | (Document.getelementbyid&&!document.all))
{
if (e.which==2)
{
NEWX = Window.event.x + document.body.scrollLeft
Newy = Window.event.y + document.body.scrollTop
menu = Document.all.itemopen
if (Menu.style.display = "")
{
Menu.style.display = "None"
}
Else
{
Menu.style.display = ""
}
Menu.style.pixelLeft = newx
Menu.style.pixelTop = Newy
}
if (e.which==3)
{
(message);
return false;
}
}
}
if (document.layers)
{
Document.captureevents (Event.mousedown);
DOCUMENT.ONMOUSEDOWN=CLICKNS;
}
Else
{
Document.onmouseup=clickns;document.oncontextmenu=clickie;
}
Document.oncontextmenu=new Function ("return false")
</script>



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.