HTML5输入类型“数字”在Firefox中 [英] HTML5 Input type "number" in Firefox
问题描述
我正在开发一个应用程序,这个应用程序只能由内部的几个人使用,所以我很乐意告诉他们只使用Firefox或Chrome,所以我可以使用HTML5。
我正在做一个非常简单的功能:
< style>
输入:invalid {background-color:red; }
div.box {
border-color:#000;
border-width:thin;
border-style:solid;
}
< / style>
< input type =numbername =id> < small>(如果框变红,请确保没有放置空格)< / small>
在Chrome浏览器中效果很好:它变红了,不会让你提交,其他。
Firefox ...没有那么多。它就像我有一个文本类型。
这是一个已知的问题吗?解决方法?
首先,你正在使用Firefox 4? HTML5表单在版本4中有更好的支持。这个页面有关于HTML5表单和当前错误的详细信息
https://wiki.mozilla.org/User:Mounir.lamouri/HTML5_Forms
更新:如果浏览器不支持您要使用的HTML5功能,请尝试 Modernizr 。它使用JavaScript来增强支持。它的文档有关于输入类型的信息。
I am working on an app that is only used by a few people in-house, so I feel comfortable telling them to only use Firefox or Chrome, so I can use HTML5.
I was working on a very simple feature:
<style>
input:invalid { background-color: red; }
div.box {
border-color:#000;
border-width:thin;
border-style:solid;
}
</style>
<input type="number" name="id"> <small>(if the box becomes red, make sure you didn't put a space)</small>
It works great in Chrome: it becomes red and won't let you submit, without me coding anything else.
Firefox ... not so much. It acts as if I had a "text" type.
Is that a known issue? Workaround?
Thanks
First of all, are you using Firefox 4? HTML5 forms has much better support in version 4.
This page has details on HTML5 forms and the current bugs https://wiki.mozilla.org/User:Mounir.lamouri/HTML5_Forms
Update: If the browser does not support the HTML5 features you want to use, try Modernizr. It uses Javascript to enhance support. It's documentation has information about input types.
这篇关于HTML5输入类型“数字”在Firefox中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!