搞了两年的纯后台,以前学的一些前端知识现在已经忘得一干二净,最近要实现一个前端的功能,感觉上很不适应,所以就各种基础问题,各种百度。
这篇也是我试着去用的,发现还不错,分享给大家。
<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('不能为空!')" > |