The GetExtensionName() method gets the file extension name for a specified file.
This method takes path as its only parameter.
<html> <body> <script language="JScript"> <!-- function getExt() { var myObject, ext; myObject = new ActiveXObject("Scripting.FileSystemObject"); ext = myObject.GetExtensionName("c:\test.txt"); alert("The extension for the testing file is: " + ext); } --> </script> Get the extension for the file "testing.txt". <form name="myForm"> <input type="Button" value="Get Extension" onClick='getExt()'> </form> </body> </html>