1<html>
2<script type="text/JavaScript">
3function checkfile(file)
4{
5 var checkfiles=new RegExp("((^http)|(^https)|(^ftp)):\/\/(\\w)+\.(\\w)+");
6 return checkfiles.test(file);
7}
8function files()
9{
10 var frm = document.forms["formname"];
11 var str = frm.filename.value;
12 if(checkfile(str))
13 {
14 alert('验证成功!');
15 //return true;
16 }
17 else
18 {
19 alert("验证失败!");
20 //return false;
21 }
22}
23</script>
24<body>
25<form method="POST" action="" id="formid" name="formname">
26<tr>
27 <td>
28 <input name="filename" type="text" class="" />
29 </td>
30 <br>
31 <input type="button" name="check" value="验证" onclick="files()">
32</tr>
33</form>
34</body>
35</html>
2<script type="text/JavaScript">
3function checkfile(file)
4{
5 var checkfiles=new RegExp("((^http)|(^https)|(^ftp)):\/\/(\\w)+\.(\\w)+");
6 return checkfiles.test(file);
7}
8function files()
9{
10 var frm = document.forms["formname"];
11 var str = frm.filename.value;
12 if(checkfile(str))
13 {
14 alert('验证成功!');
15 //return true;
16 }
17 else
18 {
19 alert("验证失败!");
20 //return false;
21 }
22}
23</script>
24<body>
25<form method="POST" action="" id="formid" name="formname">
26<tr>
27 <td>
28 <input name="filename" type="text" class="" />
29 </td>
30 <br>
31 <input type="button" name="check" value="验证" onclick="files()">
32</tr>
33</form>
34</body>
35</html>