范围输入类型的步长参数 [英] Step parameter for input type of range

查看:84
本文介绍了范围输入类型的步长参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在range元素内为步长参数指定小数?根据我读过的几篇文章,其中包括 Nettuts ,这应该是可能的.在任何浏览器中似乎都无法正常运行.我已经尝试过Chrome,Safari和移动Safari.我是不是在这里误解了,还是现在还不支持?

Is it possible to specify a decimal for a step parameter within the range element? According to a few articles I've read, including one on Nettuts, this should be possible. This does not appear to be working in any browsers. I've tried Chrome, Safari, and mobile Safari. Am I misunderstanding simple here, or is this just not supported quite yet?

 <input id='something' type='range' min='0' max='20' step='.25' value='5' />

推荐答案

http://jsfiddle.net/Df57B/

查看此演示,可以用十进制表示步骤.

Check out this demo it is possible to give steps in decimal.

<input type="range" name="points" min="1" max="10" 
       step="0.25" onchange="alert(this.value)"/>

您的错误判断是,您给了.25而不是0.25.

Your mistake take is that you gave .25 instead of 0.25.

这篇关于范围输入类型的步长参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆