原文:input 輸入框只能輸入數字或帶有兩位小數的數字

lt input class input text type text placeholder 請輸入上限 maxlength onkeyup this.value this.value.replace d . d , g, gt . 的正則表達式: . d 只能輸入整數或小數: . , ...

2019-10-16 14:15 0 691 推薦指數:

查看詳情

input輸入框只能輸入數字小數點后兩位

//input輸入框只能輸入數字小數點后兩位 function num(obj,val){ obj.value = obj.value.replace(/[^\d.]/g,""); //清除"數字"和"."以外的字符 obj.value = obj.value.replace ...

Mon Nov 27 23:47:00 CST 2017 0 4232
控制input只能輸入數字兩位小數

<input type="text" name="je" onkeyup="clearNoNum(this)" /> function clearNoNum(obj){ obj.value = obj.value.replace(/[^\d.]/g,""); //清除"數字 ...

Wed Mar 28 01:21:00 CST 2018 1 1383
 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM