只能輸入英文
<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" />
無法粘貼,右鍵不會彈出粘貼菜單
只能輸入數(shù)字:
<input onkeyup="this.value=this.value.replace(//D/g,'')"onafterpaste="this.value=this.value.replace(//D/g,'')">
只能輸入數(shù)字,小數(shù)點:
<input name="price" type="text"onkeyup="value=value.replace(/[^/d/.]/g,'')">
只能輸入數(shù)字,小數(shù)點,下劃線:
<input name="price" type="text"onkeyup="value=value.replace(/[^/d/._]/g,'')">
只能輸入英文和數(shù)字:
<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">
無法切換輸入法
只能輸入中文、英文、數(shù)字、@符號和.符號:
<input type="text"onkeyup="value=value.replace(/[^/a-/z/A-/Z0-9/u4E00-/u9FA5/@/.]/g,'')">
不能為空:
<input onblur="if(this.value.replace(/^ +| +$/g,'')=='')alert('不能為空!')">
以上就是本文的全部內(nèi)容,希望本文的內(nèi)容對大家的學(xué)習(xí)或者工作能帶來一定的幫助,同時也希望多多支持武林網(wǎng)!
新聞熱點
疑難解答