CSDN博客

img yellowhwb

javascript屏蔽键盘和鼠标按键

发表于2004/9/22 17:32:00  1003人阅读

if (window.Event)
document.captureEvents(Event.MOUSEUP);

function nocontextmenu()
{
    event.cancelBubble = true
    event.returnValue = false;
    return false;
}

function norightclick(e)
{
    if (window.Event)
    {
        if (e.which == 2 || e.which == 3)
        return false;
    }
    else if (event.button == 2 || event.button == 3)
    {
        event.cancelBubble = true
        event.returnValue = false;
        return false;
    }
}

document.oncontextmenu = nocontextmenu; // for IE5+
document.onmousedown = norightclick; // for all others

function loadpage(URL)
{
      newWin = window.open(URL, 'Article', 'resizable=yes, menubar=yes,scrollbars=yes, toolbar=no, location=no, width=650, height=450');
      newWin.focus();
}
//屏蔽键盘按键
if(event.keyCode!=13)
{
    event.keyCode=0;
    event.returnValue=false;
}

阅读全文
0 0

相关文章推荐

img
取 消
img