B/S模式下如何使软件屏蔽系统热键
public void HideAllFunction(Page page)
{
if(!page.IsStartupScriptRegistered ("msgHideAllFunction"))
{
string clientScript=@"<script language=JavaScript>
function KeyDown(){
if ((window.event.altKey)&& ((window.event.keyCode==37)||(window.event.keyCode==39))) //屏蔽 Alt+ 方向键 ← //屏蔽 Alt+ 方向键 →
{
event.returnValue=false;
}
if (event.keyCode==116) //屏蔽 F5 刷新键
{
event.keyCode=0;
event.returnValue=false;
}
if ((event.ctrlKey)&&(event.keyCode==78))//屏蔽 Ctrl+n
{
event.returnValue=false;
}
if ((event.shiftKey)&&(event.keyCode==121))//屏蔽 shift+F10
{
event.returnValue=false;
}
if (event.keyCode==122)//屏蔽 F11
{
event.keyCode=0;
event.returnValue=false;
}
}
{
if(!page.IsStartupScriptRegistered ("msgHideAllFunction"))
{
string clientScript=@"<script language=JavaScript>
function KeyDown(){
if ((window.event.altKey)&& ((window.event.keyCode==37)||(window.event.keyCode==39))) //屏蔽 Alt+ 方向键 ← //屏蔽 Alt+ 方向键 →
{
event.returnValue=false;
}
if (event.keyCode==116) //屏蔽 F5 刷新键
{
event.keyCode=0;
event.returnValue=false;
}
if ((event.ctrlKey)&&(event.keyCode==78))//屏蔽 Ctrl+n
{
event.returnValue=false;
}
if ((event.shiftKey)&&(event.keyCode==121))//屏蔽 shift+F10
{
event.returnValue=false;
}
if (event.keyCode==122)//屏蔽 F11
{
event.keyCode=0;
event.returnValue=false;
}
}
function nocontextmenu()
{
event.cancelBubble = true
event.returnValue = false;
return false;
}
document.onkeydown = KeyDown;
document.oncontextmenu=nocontextmenu;
</script>";
page.RegisterStartupScript("msgHideAllFunction",clientScript);
}
}