Web page
Can only be a limited number of things
Enter to move the cursor to the next input box
<input >
Can only be Chinese <input onkeyup= "value=value.replace (/[-~]/g,") ">
Shielding Input Method <input style= "ime-mode:disabled" >
can only input English and digital <input onkeyup= "Value=value.replace (/[\w]/g,") "Onbeforepaste=" Clipboarddata.setdata (' text ', Clipboarddata.getdata (' text '). Replace (/[^\d]/g, ') ">
Can only be digital <input onkeyup= "Value=value.replace (/[^\d]/g,") "Onbeforepaste=" Clipboarddata.setdata (' text ', Clipboarddata.getdata (' text '). Replace (/[^\d]/g, ') ">
Can only display, cannot modify <input readonly value= "Only show, cannot modify" >
Can only be a number to determine the value of the key.
<script language=javascript>
function Onlynum ()
{
if (!) ( (event.keycode> =48&&event.keycode<=57) | | (event.keycode> =96&&event.keycode<=105) | | (event.keycode==8)))
Event.returnvalue=false;
}
</script>
<input >
Attach: Get the keycode of keyboard
<script language= "JavaScript" >
NS4 = (document.layers)? True:false;
ie4 = (document.all)? True:false;
function KeyDown (e) {
if (NS4) {
var Nkey=e.which;
var iekey= ' is now NS browser ';
var realkey=string.fromcharcode (E.which);
}
if (IE4) {
var Iekey=event.keycode;
var nkey= ' is now IE browser ';
var realkey=string.fromcharcode (Event.keycode);
if (event.keycode==32) {realkey= ' \ ' Space \ '}
if (event.keycode==13) {realkey= ' \ ' carriage return \ '}
if (event.keycode==27) {realkey= ' \ esc\ '}
if (event.keycode==16) {realkey= ' \ shift\ '}
if (event.keycode==17) {realkey= ' \ ctrl\ '}
if (event.keycode==18) {realkey= ' \ alt\ '}
}
Alert (in ' NS browser key value: ' +nkey+ ' \ n ' + ' + ' IE browser key value: ' +iekey+ ' \ n ' + ' actual key is ' +realkey ');
}
Document.onkeydown = KeyDown;
if (NS4) {
Document.captureevents (Event.keydown);}
</script>
<body>
Javascript Document.
<center>
</center>
</body>
restricting keyboard for Web pages
<body >
Restrict a key on the keyboard: Body onkeydown= "if (event.keycode==num) {alert (' disabled '); return false;}
[1] [2] Next page