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

推荐订阅源

Schneier on Security
Schneier on Security
D
Darknet – Hacking Tools, Hacker News & Cyber Security
T
Tenable Blog
P
Proofpoint News Feed
V
Vulnerabilities – Threatpost
Project Zero
Project Zero
Latest news
Latest news
S
Schneier on Security
C
Cyber Attacks, Cyber Crime and Cyber Security
T
Threatpost
Simon Willison's Weblog
Simon Willison's Weblog
Cyberwarzone
Cyberwarzone
T
The Exploit Database - CXSecurity.com
C
CERT Recently Published Vulnerability Notes
Spread Privacy
Spread Privacy
Cisco Talos Blog
Cisco Talos Blog
T
Troy Hunt's Blog
S
Secure Thoughts
C
Cisco Blogs
Application and Cybersecurity Blog
Application and Cybersecurity Blog
V2EX - 技术
V2EX - 技术
Hacker News: Ask HN
Hacker News: Ask HN
O
OpenAI News
L
LINUX DO - 最新话题
T
Threat Research - Cisco Blogs
Recent Commits to openclaw:main
Recent Commits to openclaw:main
P
Palo Alto Networks Blog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
博客园_首页
月光博客
月光博客
博客园 - 【当耐特】
雷峰网
雷峰网
C
CXSECURITY Database RSS Feed - CXSecurity.com
博客园 - 叶小钗
aimingoo的专栏
aimingoo的专栏
L
Lohrmann on Cybersecurity
D
DataBreaches.Net
美团技术团队
B
Blog
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
有赞技术团队
有赞技术团队
D
Docker
Jina AI
Jina AI
The GitHub Blog
The GitHub Blog
H
Hacker News: Front Page
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
AI
AI
Martin Fowler
Martin Fowler
Attack and Defense Labs
Attack and Defense Labs
小众软件
小众软件

博客园 - 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)  评论()    收藏  举报