html5 邮编号验证实例

来源:互联网 时间:1970-01-01

html5 邮编号验证实例

html5 required pattern pattern是设置正则的地方,与js有所不同哦,

<!doctype html>

<html lang="en">

<head>

<meta charset=utf-8 />

<title>pattern</title>

</head>

<body>

  <form>

    <input required pattern="[0-9]{5}(-[0-9]{4})?|[a-za-z]{1,2}d{1,2}s?d[a-za-z]{1,2}" name=part title="a zip code or postcode in the format of 99999 or 99999-9999" >

  <input type=submit>

  </form></body>

</html>




相关阅读:
Top