function $(o) { return document.getElementById(o) } $('test').onblur = function() { debugger; var re = /^\d+(\.\d)?$/; var bol = re.test(this.value); if (bol == true) { } else { alert("123"); } } 他是空也是flase...直接彈出123...能不能在他是數字和小數和空的情況下是true.....謝謝了
2 回答

慕姐8265434
TA貢獻1813條經驗 獲得超2個贊
function $(o) { return document.getElementById(o) } $('test').onblur = function() { debugger; var re = /^\d+(\.\d)?$/; var bol = re.test(this.value); if (bol == true) { } else if(this.value !== ""){ alert("123"); } }
加了一個為空的判斷
- 2 回答
- 0 關注
- 773 瀏覽
添加回答
舉報
0/150
提交
取消