网页中如何禁用键盘方向键和输入法
2012/5/21 14:28:57

网页中禁用键盘方向键

<script>
document.onkeydown=function(e) 

e=window.event||e;
switch(e.keyCode)
{
case 37: //左键
return  false;
break;
case 38: //向上键
return false;
break;
case 39:  //右键
return false;
break;
case 40: //向下键
return false;
break; 
default:
return false;
break;

}
</script>

网页中禁用输入法

非常简单,只要在input添加  style="ime-mode:disabled" 这个就行了!
例:
“<input  style="ime-mode:disabled">”


其它:
<script language="JavaScript">
<!--
function key(){
if(event.shiftKey){
window.close();}
//禁止shift
if(event.altKey){
window.close();}
//禁止alt
if(event.ctrlKey){
window.close();}
//禁止ctrl
return false;}
document.onkeydown=key;
if (window.Event)
document.captureEvents(Event.MOUSEUP);
//swordmaple javascript article.
//from www.jx165.com
function nocontextmenu(){
event.cancelBubble = true


http://www.etoow.com/html/2007-08/1186902573.htmlevent.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
//-->
</script>
<body onselectstart="return false"; onpaste="return false";>
选择字符试试1010110
<input size=30>
<!--onselectstart禁止选择 onpaste禁止粘贴-->

返回列表
返回首页
©2024 金松软件
Powered by iwms