现在的位置: 首页 > 综合 > 正文

javascript 禁用F5等功能键

2011年01月25日 ⁄ 综合 ⁄ 共 1037字 ⁄ 字号 评论关闭
function window.onhelp()//屏蔽F1帮助
{
    return false;
}
 
function document.onkeydown()
{
    if
            ((window.event.altKey && window.event.keyCode == 37) //屏蔽 Alt+ 方向键 ←
            || (window.event.altKey && window.event.keyCode == 39)//屏蔽 Alt+ 方向键 →
            || (window.event.ctrlKey && window.event.keyCode == 78)//CtrlN
            || (window.event.ctrlKey && window.event.keyCode == 82)//CtrlR
            || (window.event.keyCode == 116)//屏蔽 F5 
            )
    {
        window.event.keyCode = 0;
        window.event.returnvalue = false;
        return false;
    }
}

抱歉!评论已关闭.