<ptml> <pead> <title>text Digital </title> <meta http-equiv= "Content-type" content= "text/html; CHARSET=GBK "> </pead> <script type=" Text/javascript "> Function check (event) {var e = window.event | | e Vent var target = E.srcelement | | E.target; var k = E.keycode; if (Isfunkey (k)) {return true; var C = GetChar (k); if (target.value.length = = ' && (c = = ' | | | | c = = ' + ')) {return true; } if (isNaN (Target.value + GetChar (k))) {return false; return true; } function Isfunkey (code) {//8--> Backspace//--> End//--> home//Notoginseng--> left Arrow//39- -> right Arrow//--> Delete//112~123--> f1~f12 var funkeys = [8, 35, 36, 37, 39, 46]; for (var i = 112 I <= 123; i++) {Funkeys.push (i); for (var i = 0; i < funkeys.length i++) {if (funkeys[i] = = code) {return true; return false; } function GetChar (k) {if (K >= && k <=) {return string.fromcharcode (k); } if (k >= && K <=) {return string.fromcharcode (k-48); } if (k = = | | | k = = 190 | | k== 188) {return "." } if (k = = 109 | | k = = 189) {return "-"; } if (k = = | | k = = 187) {return "+"; Return "#"; } </script> <style type= "Text/css" > textarea {width:200px; height:80px; span {color: #ff0000; </style> <body> <input onpaste= ' return false ' onkeydown= ' return Check (event) ' onkeyup= ' if isNaN (this. Value) | | this.value<0| | this.value>59) this.value= ' 0 ' "> </body> </ptml>
[ctrl+a All selected note: If you need to introduce external JS need to refresh to perform]