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

推荐订阅源

AI
AI
O
OpenAI News
Engineering at Meta
Engineering at Meta
F
Fortinet All Blogs
Jina AI
Jina AI
D
Docker
N
News and Events Feed by Topic
TaoSecurity Blog
TaoSecurity Blog
雷峰网
雷峰网
V
V2EX
小众软件
小众软件
N
News | PayPal Newsroom
GbyAI
GbyAI
Recorded Future
Recorded Future
SecWiki News
SecWiki News
WordPress大学
WordPress大学
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
酷 壳 – CoolShell
酷 壳 – CoolShell
Security Latest
Security Latest
Google DeepMind News
Google DeepMind News
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Hacker News: Ask HN
Hacker News: Ask HN
Project Zero
Project Zero
Cyberwarzone
Cyberwarzone
MyScale Blog
MyScale Blog
T
The Blog of Author Tim Ferriss
U
Unit 42
The Last Watchdog
The Last Watchdog
V
Visual Studio Blog
C
Cisco Blogs
T
Tor Project blog
Google Online Security Blog
Google Online Security Blog
I
InfoQ
Attack and Defense Labs
Attack and Defense Labs
Y
Y Combinator Blog
博客园 - 聂微东
L
LangChain Blog
Blog — PlanetScale
Blog — PlanetScale
Apple Machine Learning Research
Apple Machine Learning Research
S
Schneier on Security
S
Securelist
博客园_首页
W
WeLiveSecurity
P
Privacy International News Feed
S
SegmentFault 最新的问题
博客园 - 【当耐特】
L
LINUX DO - 热门话题
Latest news
Latest news
大猫的无限游戏
大猫的无限游戏
M
MIT News - Artificial intelligence

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