Friday, June 29, 2007

Get file extension using javascript

Get file extension using javascript:
=============================


//way to call
GetExtension(form1.attach1.value);


function GetExtension(filename) {
var ext;
//get last 3 letters i.e. extension
ext=filename.substring(filename.length-3,filename.length);
return ext;
}

No comments: