标签:
<fieldset> <legend>验证IP地址</legend> <input type="text" id="domain" value="" style="width:150px;height:22px;" class=""> <button value="查询" onclick="domain_check()">查询</button> <script> function domain_check(){ var domain = $("#domain").val(); var reg = /^(\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 (!reg.test(domain)) { if((domain != "")&&(domain != null)){ alert("请输入正确的用户IP地址"); return false; } } } </script> </fieldset>
标签:
原文地址:http://www.cnblogs.com/futai/p/5725771.html