【发布时间】:2012-01-26 14:07:16
【问题描述】:
我想禁用或覆盖浏览器的默认帮助功能。
我尝试在网上查看一些示例,但它们对我不起作用。 (以下代码适用于 Firefox 和 Chrome,但不适用于 Opera 和 IE)
<html>
<title>
</title>
<body>
<script src = "jquery-1.7.1.min.js" text="type="text/javascript""></script>
<script language="javascript" type="text/javascript">
document.onkeydown = function(event)
{
if(window.event && window.event.keyCode == 112)
{
event.stopPropagation();
event.preventDefault();
event.keyCode = 0;
return false;
//document.onhelp = new Function("return false;");
//window.onhelp = new Function("return false;");
//helpFunction();
}
else if(event.which == 112)
{
helpFunction();
}
};
var false_function = new function(){"return false";};
shortcut.add("f1",false_function);
var helpFunction = function() {
alert('help');
}
</script>
<h2>Test</h2>
</body>
【问题讨论】:
-
如何将它添加到我的浏览器?
-
@erjoalgo 如果您是网站所有者,请将此添加到您的网站。
标签: javascript jquery cross-browser dom-events