|
<script language= "JavaScript" >
<!--
Go to left space
function LTrim (s) {
Return S.replace (/^s*/, "");
}
Go to the right space
function RTrim (s) {
Return S.replace (/s*$/, "");
}
Go to the left and right space
function Trim (s) {
return RTrim (LTrim (s));
}
Get file name extension
function Get_ext (F_path) {
var ext = ';
if (F_path!= null && trim (f_path). length > 0) {
F_path = Trim (F_path);
ext = f_path.substring (F_path.lastindexof (".") + 1, f_path.length);
}
return ext;
}
Verifying file name extension
function Chk_ext (F_path) {
var ext = get_ext (F_path);
Customized according to requirements
var accept_ext = new Array ("Doc", "PDF", "BPM", "JPEG", "JPG", "gif", "ppt", "xls");
var flag = false;
if (ext!= ') {
for (var i=0; i<accept_ext.length; i++) {
if (ext = = Accept_ext[i])
Flag = true;
}
}
return flag;
}
-->
</SCRIPT>
|