邮编号码验证代码

zipcode
 

if (document.regform.u_zipcode.value == ""){
  alert ("提示: 必须输入邮编!");
  document.regform.u_zipcode.focus();
  return false;
 }
 if (document.regform.u_zipcode.value.length!=6){
  alert ("提示: 邮编长度不正确!");
  document.regform.u_zipcode.focus();
  return false;
 }
 bstring = "0123456789";
 for(i = 0; i < document.regform.u_zipcode.value.length; i ++)
 {
  if (bstring.indexof(document.regform.u_zipcode.value.substring(i,i+1))==-1)
  {
   alert('邮编 只能包含数字及-*');
   document.regform.u_zipcode.focus();
   return false;
  }
 }

实例说明

<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">
<html xmlns="http://www.111cn.net/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312" />
</head>

<body>
<form id="form1" name="regform" method="post" action="">
  <label>
  输入邮编:
  <input type="text" name="u_zipcode" />
  </label>
  <label>
  <input type="submit" name="submit" value="验证"  onclick="checkzip();"/>
  </label>
</form>
</body>

时间: 2024-09-20 22:30:33

邮编号码验证代码的相关文章

jsp身份证号码验证代码(15,18位)

<%@ page contenttype="text/html; charset=gb2312" language="java" import="java.sql.*" errorpage="" %> <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml

asp.net 中国身份证号码验证代码 非正则_实用技巧

复制代码 代码如下: using System; /// <summary> /// Summary description for IDCardValid /// </summary> public class IDCardValid { public IDCardValid() { // // TODO: Add constructor logic here // } /// <summary> /// 验证身份证号码 /// </summary> //

javascript 公民身份号码验证代码

function isidcardno(idvalue) {         var len=0, re;         len=idvalue.length;         if (len == 15 && isnumberstring(idvalue,"1234567890"))         re = new regexp(/^(d{6})()?(d{2})(d{2})(d{2})(d{3})$/);         else if (len == 18 &

js电子邮箱 QQ号码 MSN验证代码

email 邮箱验证       if (document.regform.u_email.value.length==0) {                 alert("提示: 请填写你的email地址");     document.regform.u_email.focus();                 return false;              }      else if ((document.regform.u_email.value.indexof(

js实现二代身份证号码验证详解_javascript技巧

废话少说,直接上代码,注释里解析的很清楚了,这里就不BB了. 复制代码 代码如下: /* 根据[中华人民共和国国家标准 GB 11643-1999]中有关公民身份号码的规定,公民身份号码是特征组合码,由十七位数字本体码和一位数字校验码组成.排列顺序从左至右依次为:六位数字地址码,八位数字出生日期码,三位数字顺序码和一位数字校验码.  地址码表示编码对象常住户口所在县(市.旗.区)的行政区划代码.  出生日期码表示编码对象出生的年.月.日,其中年份用四位数字表示,年.月.日之间不用分隔符.  顺序

不要再喊“谁给我一个身份证号码验证的代码”了,脚本之家站长提供了_应用技巧

QQ群里的兄弟问"谁给我一个身份证号码验证的代码"正好我也需要就从网上找了下代码,感觉不错,适合15和18位的身份证,网上好的垃圾站,都是直接采集csdn的问题,答案都没有,汉 用javascript验证15位或18位身份证号码 ,最离谱的事,竟然有人搜给我一个身分证号码,给我一个身份证看样大家很厉害啊,有可能大家是要一个身份证生成器吧,好的,我提供下吧 复制代码 代码如下: function   checkIDCard   (str)        {   //身份证正则表达式(15

javascript身份证号码验证实例代码

<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-

手机号与传真号码正则验证代码

传真号码验证 function istel(s) { var patrn=/^[+]{0,1}(d){1,3}[ ]?([-]?(d){1,12})+$/; var patrn=/^[+]{0,1}(d){1,3}[ ]?([-]?((d)|[ ]){1,12})+$/; if (!patrn.exec(s)) return false return true } 手机号码验证 function ismobil(s) { var patrn=/^[+]{0,1}(d){1,3,5}[ ]?([-

表单验证代码实例:jquery.validate.js表单验证插件

文章简介:很好用的JQuery表单验证插件--jquery.validate.js. jquery.validate.js是JQuery旗下的一个验证插件,借助JQuery的优势,我们可以迅速验证一些常见的输入,并且可以自己扩充自己的验证方法.使用前请先下载必要的JQuery插件:jquery-1.4.2.min.js和jquery.validate.min.js. 下面演示如何使用jquery.validate.js插件进行表单的验证. 这是HTML表单:<form id="regFro