<input type="text" onkeyup="!/^(\d+\.?)?\d{0,2}$/.test(this.value)?(this.value=this.value.substring(0, this.value.length-1)): ''"/> 複製代碼
親測有效,不喜勿噴,見諒!bash