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

推荐订阅源

Hacker News: Ask HN
Hacker News: Ask HN
C
Cisco Blogs
The Hacker News
The Hacker News
T
Tor Project blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
The GitHub Blog
The GitHub Blog
A
Arctic Wolf
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
The Register - Security
The Register - Security
云风的 BLOG
云风的 BLOG
Simon Willison's Weblog
Simon Willison's Weblog
P
Palo Alto Networks Blog
Vercel News
Vercel News
C
CERT Recently Published Vulnerability Notes
I
InfoQ
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
M
MIT News - Artificial intelligence
I
Intezer
aimingoo的专栏
aimingoo的专栏
U
Unit 42
C
Cyber Attacks, Cyber Crime and Cyber Security
L
LINUX DO - 热门话题
Microsoft Security Blog
Microsoft Security Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
Cyberwarzone
Cyberwarzone
P
Proofpoint News Feed
P
Proofpoint News Feed
B
Blog
T
Threat Research - Cisco Blogs
博客园 - 叶小钗
Recorded Future
Recorded Future
Last Week in AI
Last Week in AI
N
News and Events Feed by Topic
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Know Your Adversary
Know Your Adversary
Engineering at Meta
Engineering at Meta
G
Google Developers Blog
PCI Perspectives
PCI Perspectives
Google DeepMind News
Google DeepMind News
WordPress大学
WordPress大学
Application and Cybersecurity Blog
Application and Cybersecurity Blog
MyScale Blog
MyScale Blog
Security Archives - TechRepublic
Security Archives - TechRepublic
Schneier on Security
Schneier on Security
N
News | PayPal Newsroom
C
Cybersecurity and Infrastructure Security Agency CISA
H
Help Net Security
博客园 - 聂微东
H
Hackread – Cybersecurity News, Data Breaches, AI and More
G
GRAHAM CLULEY

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