HTML页面右键事件

<script type="text/javascript">
<!--
document.onmousedown = function (e) {
var e = e || window.event
alert("e" + e.button);
if (e.button == "2") {
alert("执行右键代码");
}
}
//-->
function right() {

var e = window.event;
alert(e.button);
if (e.button == "0") {
alert("左键");
} else {
alert("右键");
}
}
</script>

posted @ 2017-09-08 13:47  天晴微笑  阅读(904)  评论(0编辑  收藏  举报