惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

量子位
S
Securelist
MyScale Blog
MyScale Blog
Jina AI
Jina AI
罗磊的独立博客
The Cloudflare Blog
美团技术团队
博客园 - 叶小钗
阮一峰的网络日志
阮一峰的网络日志
博客园 - 三生石上(FineUI控件)
月光博客
月光博客
雷峰网
雷峰网
小众软件
小众软件
aimingoo的专栏
aimingoo的专栏
大猫的无限游戏
大猫的无限游戏
博客园 - Franky
博客园 - 聂微东
Y
Y Combinator Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
MongoDB | Blog
MongoDB | Blog
T
Tailwind CSS Blog
Attack and Defense Labs
Attack and Defense Labs
博客园_首页
Latest news
Latest news
Apple Machine Learning Research
Apple Machine Learning Research
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
The Hacker News
The Hacker News
G
GRAHAM CLULEY
Simon Willison's Weblog
Simon Willison's Weblog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
P
Proofpoint News Feed
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
U
Unit 42
D
Docker
Webroot Blog
Webroot Blog
N
Netflix TechBlog - Medium
T
Tor Project blog
C
Cyber Attacks, Cyber Crime and Cyber Security
L
LINUX DO - 最新话题
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
The Last Watchdog
The Last Watchdog
B
Blog
Recent Announcements
Recent Announcements
GbyAI
GbyAI
Microsoft Azure Blog
Microsoft Azure Blog
Security Latest
Security Latest
V2EX - 技术
V2EX - 技术
N
News | PayPal Newsroom
Microsoft Security Blog
Microsoft Security Blog

博客园 - Machine Lee

js动态更换img的src问题 两台服务器上SQL Server数据库数据互操作示例 JQuery应用集合 SVN自动更新测试服务器工作副本(C#写winform程序实现) 学习《SQL Server 2005管理员大全》时遇到的困难 ASP.NET根据URL生成网页缩略图示例程序(C#语言) 传参防SQL注入函数 web.config中sessionState节点的配置方案 SQL中DateTime转换成Varchar样式 ASP错误信息提示函数 - Machine Lee - 博客园 ASP操作Excel技术总结[转载收藏] 正则表达式验证可发短信的号码,如手机号和小灵通号码(106+区号+号码) SQL中实现Split的功能函数 GridView中CheckBox客户端全选 验证多行文本框输入长度的正则表达式 TreeView动态构造多级树并实现拖动(收藏) javascript写的日历控件(收藏) javascript获取TreeView控件选中节点的Text和Value TreeView绑定XML数据源C#代码示例
js控制文本框只能输入整数或浮点数
Machine Lee · 2010-04-06 · via 博客园 - Machine Lee

js函数:

function CheckInputIntFloat(oInput)
{
    if('' != oInput.value.replace(/\d{1,}\.{0,1}\d{0,}/,''))
    {
        oInput.value = oInput.value.match(/\d{1,}\.{0,1}\d{0,}/) == null ? '' :oInput.value.match(/\d{1,}\.{0,1}\d{0,}/);
    }
}

HTML代码:

<input type="text" id="input1" name="input1" onkeyup="javascript:CheckInputIntFloat(this);" />

posted on 2010-04-06 16:13  Machine Lee  阅读(5996)  评论(0)    收藏  举报