Home  >  Article  >  Web Front-end  >  js browse local folder system sample code_javascript skills

js browse local folder system sample code_javascript skills

WBOY
WBOYOriginal
2016-05-16 17:18:511173browse
Copy code The code is as follows:

function BrowseFolder(){
try{
var Message = "Please select a folder"; //Select box prompt message
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(); // Return FolderItems object
Folder = Folder.item(); // Return Folderitem object
Folder = Folder.Path; // Return path
if(Folder.charAt (Folder.length-1) != "\"){
Folder = Folder "\";
}
document.all.savePath.value=Folder;
return Folder;
}
}catch(e){
//alert(e.message);
}
}
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn