当前位置: 动力学知识库 > 问答 > 编程问答 >

Firefox always show any numeric input as NAN

问题描述:

I installed a new fresh windows 8.1 (64bit) and then install Firefox 33.1.1 without any add-on or extensions after that. but Firefox show every numeric input (type="number") as NAN even without any JavaScript code. (other browser haven't any problem with that.)

for example code below show as this:

<!doctype html>

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>

</head>

<body>

<form method="post" action="">

<input type="number" />

</form>

</body>

</html>

网友答案:

this is a bug in Firefox!

i think this problem exists for the Persian language (or maybe arabic)

To fix this problem in windows, set Decimal Symbol to Dot "."

Note: Region > Additional Setting

But in my opinion, now is the best solution use type="text" instead of type"number" for inputs

网友答案:

I see It`s happening in Firefox only when settings of Windows in Control Panel --> Language --> Change date, time, or number formats --> Format is set to Persian (I have Win 8.1 + FireFox 39.0-fa)

网友答案:
  • Your meta tag is inappropriate for HTML5. There is a specific META Charset tag for HTML5. See http://www.w3schools.com/tags/att_meta_charset.asp
  • In HTML you must not use XML closing tags />

You can also help yourself by adding more content to your HTML, such as adding an encytpye to the form and more:

<form method="post" action="" enctype="multipart/form-data">
    <input type="number" name="larry" min="0" max="100" value="">
</form>

Try that syntax and see if it corrects.

分享给朋友:
您可能感兴趣的文章:
随机阅读: