加载中…
个人资料
  • 博客等级:
  • 博客积分:
  • 博客访问:
  • 关注人气:
  • 获赠金笔:0支
  • 赠出金笔:0支
  • 荣誉徽章:
正文 字体大小:

文本框失去焦点后js判断输入是否为数字

(2018-04-28 12:42:48)
标签:

asp

js

文本框失去焦点后js判断输入是否为数字
━━━━━━━━━━━━━━━━━━━━━━━━━
< html >
<
head >
<
title > 文本框失去焦点后js判断输入是否为数字 < / title >
<
script Type = "text/javascript" >
Function ischeckNum()
{
var num Document.getElementById('isnum').value;
Ifnum )
{
If!isNaNnum )
{
alert('是数字');
return False;
}
Else
{
alert('你输入的数据不是数字');
Document.getElementById('isnum').value= ";
Document.getElementById('isnum').focus();
return False;
}
}
Else
{
alert('需输入内容');
Document.getElementById('isnum').focus();
}
}
< / script >
< /
head >
<
body >
<
Form  method = "postaction = "" >
<
input Type = "textname = "isnum id = "isnum onblur = "ischeckNum();>
< /
Form >
< /
body >
< /
html >

0

阅读 收藏 喜欢 打印举报/Report
  

新浪BLOG意见反馈留言板 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 产品答疑

新浪公司 版权所有