如何在浏览文件时,定义浏览文件的种类.

当我想上传文件时,想定义上传文件的种类,以防上传的文件类型不符合,
如何在浏览文件时,定义浏览文件的种类.
---------------------------------------------------------------

 1<script language="JavaScript">   
 2<!--   
 3function s(o)   
 4{   
 5if(!/(doc &brvbarjpg &brvbargif)$/ig.test(o.value))   
 6{   
 7alert("请选择doc,jpg,gif文件!");   
 8o.select();   
 9document.execCommand("delete");   
10}   
11}   
12//-->   
13</script>
1<input onchange="s(this)" type="file"/>

---------------------------------------------------------------

Published At
Categories with Web编程
comments powered by Disqus