JavaScriptでフォルダ選択ダイアログを表示する

サンプルコード:
function browseFolder(path)
{
try
{
var Message = “use file system”;
var Shell = new ActiveXObject(“Shell.Application”);
var Folder = Shell.BrowseForFolder(0, Message, 64, 17);
//var Folder = Shell.BrowseForFolder(0,Message,0);
if (Folder != null) {
Folder = Folder.items();
Folder = Folder.item();
Folder = Folder.Path;
if (Folder.charAt(Folder.length – 1) != “\\”) {
Folder = Folder + “\\”;
}
document.getElementById(path).value = Folder;
return Folder;
}
}
catch (e) {
alert(e.message);
}
}

Comments are closed.