html body 部分-------------------------
<body onkeydown='whichButton(event)'>
js 部分---------------------
function whichButton(event){
if((event.ctrlKey)&&(event.keyCode==80)){
event.keyCode = 0;//主要是这个哦
//alert("whichButton");
event.returnValue = false;
//return false;
}
}
本文介绍了一种使用JavaScript来禁用网页中Ctrl+P快捷键的方法,通过监听键盘事件并阻止特定组合键的功能,可以有效防止用户直接打印页面内容。
6658

被折叠的 条评论
为什么被折叠?



