1.驗證ip地址
<input name="ip" class="mini-textbox" required emptyText="請輸入ip地址" onvalidation="isIpAddress" />
// ip地址驗證 function isIpAddress(e){ var reg = new RegExp("^(\\d{1,2}|1\\d\\d|2[0-4]\\d|25[0-5])\\.(\\d{1,2}|1\\d\\d|2[0-4]\\d|25[0-5])\\.(\\d{1,2}|1\\d\\d|2[0-4]\\d|25[0-5])\\.(\\d{1,2}|1\\d\\d|2[0-4]\\d|25[0-5])$"); if (e.isValid) { if (reg.test(e.value)) { e.isValid = true; }else{ e.errorText = "請輸入正確的ip地址"; e.isValid = false; } } }
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/913.html
標籤:jQuery
上一篇:四個jQuery方法append(),prepend(),after(),before()的區別
下一篇:Jquery所有獲取物件
