对text中输入的非法字符进行识别!等问题,在线等

charlie0895 2004-07-15 04:48:16
1:对text中输入的非法字符进行识别!(其中只能输入中文,英文和数字!)
2:对text框的长度进行设定(比如一个text框长5位,则到了 5位不能继续输入)
...全文
233 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
charlie0895 2004-07-16
  • 打赏
  • 举报
回复
怎么我打出来是这个凶!真的不好意思金刚兄!
charlie0895 2004-07-16
  • 打赏
  • 举报
回复
金刚凶,第二个问题搞定了!谢,第一个问题搞定就结贴。
charlie0895 2004-07-16
  • 打赏
  • 举报
回复
金刚凶,你对第一个问题的解决,可以输入中文和数字,但是连字母也不能输入了呀!
summergood 2004-07-15
  • 打赏
  • 举报
回复
关注中,今天快下班,明天帮你解决这个问题.
LxcJie 2004-07-15
  • 打赏
  • 举报
回复
文本框有一个maxLength属性可以固定长度,其它的金刚大哥说得很全哦
gjd111686 2004-07-15
  • 打赏
  • 举报
回复
2.长度
<input onkeypress="if(this.value.length<6){return event.keyCode}else{return false}">
gjd111686 2004-07-15
  • 打赏
  • 举报
回复
1.字母
<input onkeypress="return (event.keyCode>96&&event.keyCode<123)||(event.keyCode>64&&event.keyCode<91)" onpaste="return !clipboardData.getData('text').match(/\D/)" ondragenter="return false">
gjd111686 2004-07-15
  • 打赏
  • 举报
回复
1.数字
<input onkeypress="return event.keyCode>=48&&event.keyCode<=57||event.keyCode==46" onpaste="return !clipboardData.getData('text').match(/\D/)" ondragenter="return false">

87,910

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧