input 經常使用正則

<!-- 只容許輸入數字和一位小數點和小數點後兩位 而且首位不能爲小數點 --> <input type="text" onkeyup="this.value= this.value.match(/\d+(\.\d{0,2})?/) ? this.value.match(/\d+(\.\d{0,2})?/)[0] : ''" > <!-- 只能輸入英文 --> <input type="text
相關文章
相關標籤/搜索