生活随笔
收集整理的這篇文章主要介紹了
js验证input输入框(字母,数字,符号,中文)
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
| <input type="text"?onkeyup="value=value.replace(/[^a-zA-Z]/g,'')"> |
| <input type="text"?onkeyup="value=value.replace(/[^\a-\z\A-\Z]/g,'')" |
| ????onkeydown="fncKeyStop(event)"?onpaste="return false" |
| ????oncontextmenu="return false"?/> |
| <input onkeyup="this.value=this.value.replace(/\D/g,'')" |
| ????onafterpaste="this.value=this.value.replace(/\D/g,'')"> |
| <input name="price"?type="text" |
| ????onkeyup="value=value.replace(/[^\d\.]/g,'')"> |
| <input name="price"?type="text" |
| ????onkeyup="value=value.replace(/[^\d\._]/g,'')"> |
| <input onkeyup="value=value.replace(/[\W]/g,'') " |
| ????onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))"> |
| <input onkeyup="value=value.replace(/[^\u4E00-\u9FA5]/g,'')" |
| ????onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\u4E00-\u9FA5]/g,''))"> |
| <input type="text"?style="ime-mode: disabled"> |
| ????onkeyup="value=value.replace(/[^\a-\z\A-\Z0-9\u4E00-\u9FA5\@\.]/g,'')"> |
| <input onblur="if(this.value.replace(/^ +| +$/g,'')=='')alert('不能為空!')"> |
| <br /> ? 轉至http://yuncode.net/code/c_5039bb4a3fccf28 ? |
轉載于:https://www.cnblogs.com/VicTang/p/3385378.html
總結
以上是生活随笔為你收集整理的js验证input输入框(字母,数字,符号,中文)的全部內容,希望文章能夠幫你解決所遇到的問題。
如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。