1
<html>
2
<script type="text/JavaScript">
3
function checkfile(file)
4
{
5
var checkfiles=new RegExp("((^http)|(^https)|(^ftp)):\/\/(\\w)+\.(\\w)+");
6
return checkfiles.test(file);
7
}
8
function 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

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35
