试过,已成功,放分吧
其中DoSth是所执行的函数。<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>New Page 1</title>
</head>
<script language="JavaScript">
<!-- if (window.Event)
document.captureEvents(Event.MOUSEUP);
function DoSth(e)
{
alert("Right mouse click!")} //document.oncontextmenu = nocontextmenu; // for IE5+
document.onmousedown = DoSth; // for all others
//-->
</script><body></body></html>
其中DoSth是所执行的函数。<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>New Page 1</title>
</head>
<script language="JavaScript">
<!-- if (window.Event)
document.captureEvents(Event.MOUSEUP);
function DoSth(e)
{
alert("Right mouse click!")} //document.oncontextmenu = nocontextmenu; // for IE5+
document.onmousedown = DoSth; // for all others
//-->
</script><body></body></html>
try this in IE 5 and up:<script language="javascript">
function rightClick()
{
alert("hello");
return false;
}document.oncontextmenu = rightClick;</script>