javascript求救,在页面是点左键弹出\"你好\",点右键弹出\"对不起\"
发布网友
发布时间:2024-10-23 17:41
我来回答
共1个回答
热心网友
时间:2024-11-06 06:07
<script>
if (window.Event) document.captureEvents(Event.MOUSEUP); function nocontextmenu() {
event.cancelBubble = true
event.returnValue = false;
return false;
}
if (window.Event) document.captureEvents(Event.MOUSEUP);
function c() {
if (event.button == 1)
{
alert("你好");
return false;
}
else
{
alert("对不起");
event.cancelBubble = true
event.returnValue = false;
return false;
}
}
document.onmousedown = c;
document.oncontextmenu = nocontextmenu;
</script>