失眠网,内容丰富有趣,生活中的好帮手!
失眠网 > html中input输入框禁止粘贴复制等关健名写法记录

html中input输入框禁止粘贴复制等关健名写法记录

时间:2019-08-11 15:48:42

相关推荐

html中input输入框禁止粘贴复制等关健名写法记录

禁止复制:oncopy="return false"禁止粘贴:onpaste="return false"禁止剪切:oncut="return false"关闭自动完成功能(缓存):autocomplete="off"自动获得焦点:autofocus="autofocus"禁用自动更正:autocorrect="off"来关闭键盘默认首字母大写(移动端):autocapitalize="off"不对元素的文本进行拼写检查:spellcheck="false"禁止右键弹出:oncontextmenu="return false"只输入大小写字母、数字、下划线:<input type = "text" onkeyup="this.value=this.value.replace(/[^\w_]/g,'');"> 输入数字和点<input type="text" onkeyup="value=value.replace(/[^\d.]/g,'')">输入小写字母、数字、下划线:<input type = "text" onkeyup="this.value=this.value.replace(/[^a-z0-9_]/g,'');"> 输入中文: <input type = "text" onkeyup="this.value=this.value.replace(/[^\u4e00-\u9fa5]/g,'')"> 输入数字: <input type = "text" onkeyup="this.value=this.value.replace(/\D/g,'')"> 输入英文: <input type = "text" onkeyup="this.value=this.value.replace(/[^a-zA-Z]/g,'')"> 输入中文、数字、英文: <input onkeyup = "value=value.replace(/[^\w\u4E00-\u9FA5]/g, '')" >输入数字和字母:<input onKeyUp = "value=value.replace(/[\W]/g,'')" >除了英文的标点符号以外,其他的都可以中文,英文字母,数字,中文标点<input type="text" onkeyup="this.value=this.value.replace(/^[^!@#$%^&*()-=+]/g,'')">只能输入数字代码(小数点也不能输入)<input onkeyup = "this.value=this.value.replace(/\D/g,'')">只能输入数字,能输小数点:<input onkeyup = "if(isNaN(value))execCommand('undo')"><input name = txt1 onchange="if(/\D/.test(this.value)){alert('只能输入数字');this.value='';}">只能输入英文字母和数字, 不能输入中文<input onkeyup="value=value.replace(/[^\w\.\/]/ig,'')">只能输入数字和英文<input onKeyUp = "value=value.replace(/[^\d|chun]/g,'')" >

如果觉得《html中input输入框禁止粘贴复制等关健名写法记录》对你有帮助,请点赞、收藏,并留下你的观点哦!

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。