2013-02-06 34 views
0

我有一個關於HTML5的輸入數量, 什麼是輸入型數字HTML5輸入類型數量最大限制

EG的最大限制一些查詢。

如果單擊微調器後,max大於15或17,它將顯示(數字末尾爲+16)。

第二個查詢是針對ios5的html5的datepicker事件。

感謝

回答

0

我不知道你試了一下,但沒有爲max規定限制屬性它可以是任何floating-point number

**Floating-point Number** 
A floating-point number consists of the following parts, in exactly the following order: 

    Optionally, the first character may be a "-" character. 
    One or more characters in the range "0—9". 
    Optionally, the following parts, in exactly the following order: 
     a "." character 
     one or more characters in the range "0—9" 
    Optionally, the following parts, in exactly the following order: 
     a "e" character or "E" character 
     optionally, a "-" character or "+" character 
     One or more characters in the range "0—9". 

欲瞭解更多信息。 http://www.w3.org/TR/html-markup/input.number.html

您可以找到How can I limit possible inputs in a HTML5 "number" element?

你的答案對於在線測試使用本網站http://www.w3schools.com/html/html5_form_input_types.asp

併爲datetime可以參考http://tjvantoll.com/2012/06/30/creating-a-native-html5-datepicker-with-a-fallback-to-jquery-ui/

+0

對於如<!DOCTYPE HTML> <元的charset = UTF-8 /> 之後,輸入no在文本框中,並單擊微調器,你會得到一些意想不到的 – Nomaan

+0

不,我不認爲有些錯誤,一切都很好。測試小提琴http://jsfiddle.net/TU2Xa/。請在'chrome,safari或opera中測試,因爲任何其他瀏覽器不支持它(參考http://www.w3schools.com/html/html5_form_input_types.asp) 。如果你在'alert'中得到'e',那麼不要認爲結果是意外的,因爲它是一個'浮點數',正如上面的答案所解釋的那樣。 –