Get file extension using JavaScript
function getFileExtension(filename) {
var ext = /^.+\.([^.]+)$/.exec(filename);
return ext == null ? "" : ext[1];
}
function fun_flash(name) {
var extension = getFileExtension(name);
alert(extension);
if (extension == 'swf') {
alert("flash");
}
else {
alert("image");
}
}
var ext = /^.+\.([^.]+)$/.exec(filename);
return ext == null ? "" : ext[1];
}
function fun_flash(name) {
var extension = getFileExtension(name);
alert(extension);
if (extension == 'swf') {
alert("flash");
}
else {
alert("image");
}
}
No comments:
Post a Comment