Input Type: number
The number type is used for input fields that should contain a numeric value.
Use the following attributes to specify restrictions:
max - specifies the maximum value allowed
min - specifies the minimum value allowed
step - specifies the legal number intervals
value - Specifies the default value
我用下面的 sample 試了一下
<!DOCTYPE html>
<html>
<body>
<form action="demo_form.aspx">
Quantity (between 1 and 5): <input type="number" name="quantity" min="1" max="5">
<input type="submit">
</form>
<p><b>Note:</b> type="number" is not supported in Internet Explorer 9 and earlier versions.</p>
</body>
</html>
當我輸入超過5或是其他英文字,一切如船過水無痕,什麼檢測都沒發生..........
沒有留言:
張貼留言