:
You can return a directory path.
The operation is as follows:
function Browsefolder () {try{ var Message = "Please select folder"; Select box hint information var Shell = new ActiveXObject ("Shell.Application"); var folder = Shell.browseforfolder (0,message,0x0040,0x11);//The Starting directory is: My Computer //var Folder = Shell.browseforfolder (0, message,0); The starting directory is: Desktop if (folder! = null) {folder = Folder.items (); Returns the Folderitems object Folder = Folder.item (); Returns the FolderItem object Folder = Folder.path; Returns the path if (Folder.charat (folder.length-1)! = "\ \") { folder = folder + "\ \";} return Folder; } return null; }catch (e) {alert ("Enable Acitvex control-related options in IE settings.) "); return null;}}
var Folder = Browsefolder ();
This folder here is the path returned after the selection of the directory is determined.
If I select the Works directory with the E drive, the return value is E:\works\
Note: Sometimes you may be prompted to do not have permissions and so on, because it is the client JS operation, so you need to be in the security customization of Internet options to enable some of the ActiveX options.