html5瀹炵幇 input蹇呴』涓烘墜鏈哄彿涓旈潪绌虹殑楠岃瘉鏂规硶

时间:2021-11-23 08:21:18
 
<html><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><title>IE</title><script language="javascript" type="text/javascript">function checkMobile(str) {    if(str==""){        alert("鎵嬫満鍙蜂笉鑳戒负绌猴紒");    }    else{        var re = /^1\d{10}$/                                浠?寮€濮嬪悗闈㈠姞10浣嶆暟瀛?       if (re.test(str)) {            alert("姝g‘");        } else {            alert("鎵嬫満鍙锋牸寮忛敊璇紒");        }    }}</script></head><body><input type="text" id="btn_getNum"/><input type="button" value="寰楀埌鏁板瓧" onclick="checkMobile(btn_getNum.value);"/></body></html>