在判斷讓用戶只能輸入數(shù)字時(shí),其他的以此類推大家就知道怎么弄了;
參考來源:http://lanrenjun.iteye.com/blog/602659
<input
onkeypress="return event.keyCode>=48&&event.keyCode<=57||event.keyCode==46"
onpaste="return !clipboardData.getData('text').match(/\D/)"
ondragenter="return false"
style="ime-mode:Disabled"
>
說明 :
1 只能輸入0到9和小數(shù)點(diǎn) 46為小數(shù)點(diǎn)ASCLL值
2 只能粘貼數(shù)字
3 不能拖動(dòng)內(nèi)容進(jìn)來
4 禁止使用輸入法
聯(lián)系客服