MyException - 我的异常网
当前位置:我的异常网» Java Web开发 » 电话号码的应验

电话号码的应验(2)

www.MyException.Cn  网友分享于:2013-12-25  浏览:21次

> 如: 2002-9-29 <br>

任意中文: <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 ')) "
style= "ime-mode:Disabled "
> <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 "
> 范围: a,b,c,d,e <br>

部分中文: <xmp style= "display:inline "> </xmp>

<script language=javascript>
function checkChinese(oldLength, obj)
{
var oTR = window.document.selection.createRange()
var reg = /[^一二三四五六七八九十]/g
oTR.moveStart( "character ", -1*(obj.value.length-oldLength))
oTR.text = oTR.text.replace(reg, " ")
}
</script>
<input onkeypress= "return false " onkeydown= "setTimeout( 'checkChinese( '+this.value.length+ ', '+this.uniqueID+ ') ', 1) "
onpaste = "return regInput(this,/^[一二三四五六七八九十]*$/,window.clipboardData.getData( 'Text ')) "
ondrop = "return regInput(this,/^[一二三四五六七八九十]*$/,event.dataTransfer.getData( 'Text ')) "
> 范围: 一二三四五六七八九十 <br>

这个是输入限制的 不满足要求的就不让输入 你改改吧
------解决方案--------------------
我觉得你的JS有问题,不过
<input type=text name= "iphone " onkeydown= "PhoneCheck(this) ">
每次点击键盘输入都验证

文章评论

软件开发程序错误异常ExceptionCopyright © 2009-2015 MyException 版权所有