微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

html5 – 为什么类型为“number”的html输入允许在字段中输入字母“e”?

我有以下html5输入元素:
<input type="number">

为什么此输入允许在输入字段中输入字符“e”?不能输入其他字母字符(如预期)

使用chrome v。44.0.2403.107

看看我的意思:http://www.w3schools.com/html/tryit.asp?filename=tryhtml_input_number

解决方法

因为这正是070​​00说它应该工作。数字输入可以接受 floating point numbers包括负号和e或E字符:

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

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

原文地址:https://www.jb51.cc/html5/169954.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。