謝晒的PHP網頁設計
聯絡E-mail:
sean0704@gmail.com
站內搜尋
Monday, March 19, 2012
[JavaScript] 用正規表示法 讓表單欄位只允許輸入數字(包含小數點)
允許數字和.
<input onkeyup="this.value=this.value.replace(/[^0-9.]/g,'')">
只有數字
<input onkeyup="this.value=this.value.replace(/[^0-9]/g,'')">
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment