<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
</body>
</html>
<script>
document.oncontextmenu = function (e) {
e = e || window.event;
// e.returnValue = false 兼容ie
window.event ? e.returnValue = false : e.preventDefault();
alert("阻止默认事件")
}
</script>
阻止右键默认事件
最新推荐文章于 2024-05-27 08:28:52 发布