2
目前我在格式化小數時遇到問題。輸入中的十進制數字格式化
在文本框的模糊情況下,如果用戶輸入:
1) 1 -> this should be converted to 001.00
2) 2.5 -> this should be converted to 002.50
3) .5 -> this should be converted to 000.50
4) 12.4 -> this should be converted to 012.40
所有輸入應在離開輸入或失去焦點被轉換爲相同的格式。
需要更多信息。你想要在輸入字段中進行轉換嗎?在文中?在驗證之前在服務器上?你使用jQuery或任何其他的JS框架?乾杯 –
是的,它應該轉換,而在客戶端使用純Javascript.Thnks – Renji