js 驗證url

来源:互联网 发布:js字符串转数字相加 编辑:程序博客网 时间:2024/03/29 19:36
<script type="text/javascript">function check_it(){     var theurl=document.getElementById("testtesttest").value;     var tomatch= #rules here#;     if (tomatch.test(theurl)){         window.alert("URL OK.");         return true;     }     else     {         window.alert("URL invalid. Try again.");         return false;     }}</script>

<input type="text" name="testtesttest" id="testtesttest" onblur="check_it();" />


原创粉丝点击