const flagR=true; $('.AdministrationT').mousedown(function (e) { alert(e.which) //判断鼠标点击的是什么键 1:左键 2:滚轮 3:右键 if (e.which == 3) { if (flagR) { flagR = false; $('.forbiddenJs').css({ display: 'block' }) } else { flagR = true; $('.forbiddenJs').css({ display: 'none' }) } } }) // 阻止浏览器右键默然弹出框 // document.oncontextmenu = function () { // return false // };