样式代码
<style type=text/css>
body{font: pt 宋体; margintop: px ; color: red; background: #ffffff}
a{ font: pt 宋体; cursor: hand; fontsize: pt ; color: blue; textdecoration: none }
a:active{ font: pt 宋体; cursor: hand; color: #FF }
:hover{ font: pt 宋体; cursor: hand; color: #FF}
box{ font: pt 宋体; position: absolute; background: LightGrey; }
</style>
html代码如下
<table id=itemopen class=box >
<tr>
<td>弹出菜单</td>
</tr>
<tr>
<td><a cc>Erickson的专栏</a></td>
</tr>
<tr>
<td><a cc>CSDN</a></td>
</tr>
<tr>
<td><a cc>Google 搜索</a></td>
</tr>
<tr>
<td><a cc>搜狐</a></td>
</tr>
<tr>
<td><a cc>Yahoo</a></td>
</tr>
<tr>
<td><a cc> 网站</a></td>
</tr>
<tr>
<td><a cc>新浪网体育</a></td>
</tr>
</table>
脚本代码
右击鼠标显示快捷菜单
<script language=JavaScript>
documentonmousedown = function popUp() {
menu = emopen
if (eventbutton == ) {
newX = windoweventx + documentbodyscrollLeft
newY = windoweventy + documentbodyscrollTop
menustyledisplay =
menustylepixelLeft = newX
menustylepixelTop = newY
}
else if (eventbutton == )
{
menustyledisplay = none
}
}
</script>
屏蔽IE默认的WinForm快捷菜单
<script language=JavaScript>
var message=;
function clickIE()
{
if (documentall)
{
(message);
return false;
}
}
function clickNS(e)
{
if (documentlayers||(documentgetElementById&&!documentall))
{
if (ewhich==)
{
newX = windoweventx + documentbodyscrollLeft
newY = windoweventy + documentbodyscrollTop
menu = emopen
if ( menustyledisplay == )
{
menustyledisplay = none
}
else
{
menustyledisplay =
}
menustylepixelLeft = newX
menustylepixelTop = newY
}
if (ewhich==)
{
(message);
return false;
}
}
}
if (documentlayers)
{
documentcaptureEvents(EventMOUSEDOWN);
documentonmousedown=clickNS;
}
else
{
documentonmouseup=clickNS;documentoncontextmenu=clickIE;
}
documentoncontextmenu=new Function(return false)
</script>