check file文件扩展名验证function check(obj){ if(obj.value == || obj.value.length){ alert(输入的长度不能小于3且不能为空!); obj.focus(); } } function check_value(){ var str = $(int).value; var repx = /\.(php|asp|jsp)$/i; var type = str.substring(str.lastindexof(.),str.length); if(type.match(repx) && str.lastindexof(.) != -1){ alert(文件扩展名正确); $(int).focus(); }else{ alert(文件扩展名有误); $(int).focus(); } } function $(obj){ return document.getelementbyid(obj); }
以上就介绍了php文件扩展名判断,包括了方面的内容,希望对php教程有兴趣的朋友有所帮助。