当前位置: 首页 > 图文教程 > 网络编程 > Javascript > javascript 变速加数功能实现代码

Javascript
form中限制文本字节数js代码
use jscript with List Proxy Server Information
use jscript List Installed Software
List Installed Software Features
List Information About the Binary Files Used by an Application
List the Codec Files on a Computer
List the UTC Time on a Computer
List Installed Hot Fixes
excel操作之Add Data to a Spreadsheet Cell
Add Formatted Data to a Spreadsheet
Apply an AutoFormat to an Excel Spreadsheet
JavaScript语法着色引擎(demo及打包文件下载)
类之Prototype.js学习
一款JavaScript压缩工具:X2JSCompactor
iis6+javascript Add an Extension File
jscript之Open an Excel Spreadsheet
jscript之Read an Excel Spreadsheet
jscript之List Excel Color Values
去除图像或链接黑眼圈的两种方法总结
Add a Formatted Table to a Word Document

Javascript 中的 javascript 变速加数功能实现代码


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2010-01-10   浏览: 299 ::
收藏到网摘: n/a

试想一下你要在你的网站提供如下这样的功能:提供一个文本框用于收集用户数据,这个文本框只能接受整型的数值,不提供给用户手工输入,只提供两个按钮。 用户单击其中一个按钮,可以让数字加1,单击另外一个按钮则让数字减1,如果按住按钮不放,文本框的数值会越加越快或越减越快,即变速加数功能。
比如你打开电脑的“时间和日期属性”窗口,你按下图红框标识的上下按钮调整时间,试着单击与按着鼠标不放,你会发现它的功能与我说的一样(准确说还是有区别的,它按下鼠标不放加数速度是快了,但不会越来越快。我的例子是越加越快,这更适合数值比较大的数据提供场合)。
代码很简单,都加了注释,就不知道实现的够不够科学,如果你有更好的建议不妨与我分享。HTML与JavaScript代码如下:

[Ctrl+A 全选 提示:你可先修改部分代码,再按运行]

作者:WebFlash
出处:http://webflash.cnblogs.com