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

推荐订阅源

Project Zero
Project Zero
T
The Blog of Author Tim Ferriss
云风的 BLOG
云风的 BLOG
Recent Announcements
Recent Announcements
月光博客
月光博客
B
Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Microsoft Security Blog
Microsoft Security Blog
The GitHub Blog
The GitHub Blog
Last Week in AI
Last Week in AI
罗磊的独立博客
NISL@THU
NISL@THU
酷 壳 – CoolShell
酷 壳 – CoolShell
P
Proofpoint News Feed
H
Help Net Security
L
LINUX DO - 最新话题
MongoDB | Blog
MongoDB | Blog
雷峰网
雷峰网
The Hacker News
The Hacker News
Apple Machine Learning Research
Apple Machine Learning Research
I
Intezer
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Know Your Adversary
Know Your Adversary
Recent Commits to openclaw:main
Recent Commits to openclaw:main
S
Secure Thoughts
爱范儿
爱范儿
aimingoo的专栏
aimingoo的专栏
C
CERT Recently Published Vulnerability Notes
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
N
News and Events Feed by Topic
F
Full Disclosure
人人都是产品经理
人人都是产品经理
Blog — PlanetScale
Blog — PlanetScale
Recorded Future
Recorded Future
T
Threat Research - Cisco Blogs
博客园 - 三生石上(FineUI控件)
S
Securelist
T
The Exploit Database - CXSecurity.com
Forbes - Security
Forbes - Security
H
Hacker News: Front Page
Security Archives - TechRepublic
Security Archives - TechRepublic
C
Check Point Blog
Hacker News - Newest:
Hacker News - Newest: "LLM"
V
Visual Studio Blog
Application and Cybersecurity Blog
Application and Cybersecurity Blog
T
Tor Project blog
博客园 - 司徒正美
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org

博客园 - Alter-it

新群-客户需求 IT人员的出路在哪里? .NET 2005界面渲染疑问 雅虎邮箱outlook设置 1 2 3 工作、学习 转贴:无法复制iisapp.vbs或staxmem.dll文件,需要sp1光盘 不要懦弱 网上寻梦的日子 Just do it DNS,上海花生壳DNS解析错误,只好用别的了。 郁闷了两天的web项目打包问题,欧了 JavaScript有用的代码,摘抄自:http://bbs.tech.163.com/board/rep.jsp?b=tech10&i=1296&p=0 - Alter-it - 博客园 我变成了一个挑剔的人 让人郁闷了好久的问题,终于解决了,之前网上也看到一些解决方法,但大多没有解决问题,所以记录下来,以供参考之用(ADO Could Not Find The Specified Provider) - Alter-it 一点感想 纯粹欺骗 AJAX CodeSimith使用记录 CodeSmith……我慢慢起步
控制输入数字的script - Alter-it - 博客园
Alter-it · 2006-10-31 · via 博客园 - Alter-it

javascript控制text只能输入数字
<script type="text/javascript">
function numbersonly(myfield, e, dec)
         {
             var key;
             var keychar;
             if (window.event)
              key = window.event.keyCode;
             else if (e)
              key = e.which;
             else
              return true;
             keychar = String.fromCharCode(key);
             // control keys
             if ((key==null) || (key==0) || (key==8) ||(key==9) || (key==13) || (key==27) ) return true;
             // numbers
             else if ((("0123456789").indexOf(keychar) > -1))
             return true;
             // decimal point jump
             else if (dec && (keychar == "."))
             {
                 myfield.form.elements[dec].focus();
                 return false;
             }
             else return false;
         }
</script>

以下输入框只能输入数字
<input type="text" name="vvv" value="" onKeyPress="return numbersonly(this,event,false)" maxlength="20">


不仅仅做程序员

Posted on 2006-10-31 07:44  Alter-it  阅读(717)  评论()    收藏  举报