<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>表单</title> <script src="jquery-1.8.0.min.js"></script> <style type="text/css"></style> <script> window.onload = function(){ var inpEle = document.getElementById('inp'); var myreg = /^1[3458]\d{9}$/; inpEle.onblur = function(){ var inpVal = this.value; if (!myreg.exec(inpVal)){ alert('请输入正确的手机号') }else{ alert('ok') } } } </script></head><body> <input type="text" id="inp" value="请输入手机号"></body></html>