当前位置: 移动技术网 > IT编程>开发语言>JavaScript > js jquery验证银行卡号信息正则学习

js jquery验证银行卡号信息正则学习

2018年10月19日  | 移动技术网IT编程  | 我要评论

快乐大本营 快乐男声,wow单手剑幻化,到吴起镇歌词

jquery代码

. 代码如下:


$("#bankaccountnumber").change(function(){
alert("1");
var account = $("channelform.bankaccount.account").val();
alert("2");
var reg = /^\d{19}$/g; // 以19位数字开头,以19位数字结尾
if( !reg.test(account) )
{
alert("格式错误,应该是19位数字!");
}
})


html代码

. 代码如下:


<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "https://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">
<html xmlns="https://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312" />
<title>验证银行账号</title>
<style type="text/css">
<!--
.style1 {color: #ff0000}
-->
</style>
<script language="javascript" type="text/javascript">
function check()
{
var account = document.form1.account.value;
var reg = /^\d{19}$/g; // 以19位数字开头,以19位数字结尾
if( !reg.test(account) )
{
alert("格式错误,应该是19位数字!");
}
else
{
alert("验证成功!");
}
}
</script>
</head>
<body>
<form id="form1" name="form1" method="post" action="">
<p>账号:
<input type="text" name="account" id="account" />
<span class="style1">* (19位数字)</span></p>
<p>
<input type="button" name="button" id="button" value="验证" onclick="check()" />
</p>
</form>
</body>
</html>

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网