<Scr platinum pt>
Function regInput (obj, reg, inputStr)
{
Var docSel = document. selection. createRange ()
If (docSel. parentElement (). tagName! = "INPUT") return false
OSel = docSel. duplicate ()
OSel. text = ""
Var srcRange = obj. createTextRange ()
OSel. setEndPoint ("StartToStart", srcRange)
Var str = oSel. text + inputStr + srcRange. text. substr (oSel. text. length)
Return reg. test (str)
}
</Scr platinum pt>
Lowercase English: <xmp style = "display: inline"> </xmp>
<Input onkeypress = "return regInput (this,/^ [a-z] * $/, String. fromCharCode (event. keyCode ))"
Onpaste = "return regInput (this,/^ [a-z] * $/, window. clipboardData. getData ('text '))"
Ondrop = "return regInput (this,/^ [a-z] * $/, event. dataTransfer. getData ('text '))"
Style = "ime-mode: Disabled"
> <Br>
Uppercase: <xmp style = "display: inline"> </xmp>
<Input onkeypress = "return regInput (this,/^ [A-Z] * $/, String. fromCharCode (event. keyCode ))"
Onpaste = "return regInput (this,/^ [A-Z] * $/, window. clipboardData. getData ('text '))"
Ondrop = "return regInput (this,/^ [A-Z] * $/, event. dataTransfer. getData ('text '))"
Style = "ime-mode: Disabled">
<Br>
Any number: <xmp style = "display: inline"> </xmp>
<Input onkeypress = "return regInput (this,/^ [0-9] * $/, String. fromCharCode (event. keyCode ))"
Onpaste = "return regInput (this,/^ [0-9] * $/, window. clipboardData. getData ('text '))"
Ondrop = "return regInput (this,/^ [0-9] * $/, event. dataTransfer. getData ('text '))"
Style = "ime-mode: Disabled"
> <Br>
Limit 2 decimal places: <xmp style = "display: inline"> </xmp>
<Input onkeypress = "return regInput (this,/^ \ d *\.? \ D {0, 2 }$/, String. fromCharCode (event. keyCode ))"
Onpaste = "return regInput (this,/^ \ d *\.? \ D {0, 2} $/, window. clipboardData. getData ('text '))"
Ondrop = "return regInput (this,/^ \ d *\.? \ D {0, 2} $/, event. dataTransfer. getData ('text '))"
Style = "ime-mode: Disabled"
> For example, 123.12 <br>
Date: <xmp style = "display: inline"> </xmp>
<Input onkeypress = "return regInput (this, /^ \ d {} ([-\/] (\ d {} ([-\/] (\ d })?)?)?)? $/, String. fromCharCode (event. keyCode ))"
Onpaste = "return regInput (this, /^ \ d {} ([-\/] (\ d {} ([-\/] (\ d })?)?)?)? $/, Window. clipboardData. getData ('text '))"
Ondrop = "return regInput (this, /^ \ d {} ([-\/] (\ d {} ([-\/] (\ d })?)?)?)? $/, Event. dataTransfer. getData ('text '))"
Style = "ime-mode: Disabled"
> Example: 2002-9-29 <br>
Any Chinese: <xmp style = "display: inline"> </xmp>
<Input onkeypress = "return regInput (this,/^ $/, String. fromCharCode (event. keyCode ))"
Onpaste = "return regInput (this,/^ [\ u4E00-\ u9FA5] * $/, window. clipboardData. getData ('text '))"
Ondrop = "return regInput (this,/^ [\ u4E00-\ u9FA5] * $/, event. dataTransfer. getData ('text '))"
> <Br>
<Xmp style = "display: inline"> </xmp>
<Input onkeypress = "return regInput (this,/^ [a-e] * $/, String. fromCharCode (event. keyCode ))"
Onpaste = "return regInput (this,/^ [a-e] * $/, window. clipboardData. getData ('text '))"
Ondrop = "return regInput (this,/^ [a-e] * $/, event. dataTransfer. getData ('text '))"
Style = "ime-mode: Disabled"
> Range: a, B, c, d, e <br>
Partially Chinese: <xmp style = "display: inline"> </xmp>
<Scr limit pt language = Limit Cr limit pt>
Function checkChinese (oldLength, obj)
{
Var oTR = too many Doc ument. selection. createRange ()
Var reg =/[^ 80 or 90,]/g
OTR. moveStart ("character",-1 * (obj. value. length-oldLength ))
OTR. text = oTR. text. replace (reg ,"")
}
</Scr platinum pt>
<Input
Onpaste = "return regInput (this,/^ [80 or 90,] * $/, window. clipboardData. getData ('text '))"
Ondrop = "return regInput (this,/^ [80 or 90,] * $/, event. dataTransfer. getData ('text '))"
> Scope: 1234, 80 or 90 <br>