JSP/HTML选择文件夹,并显示名称


选择文件夹:
< input id="path" type="text" name="path" size="30">
< input type=button value="选择" οnclick="browseFolder('path')">


/ /选择文件夹    IE选项里设置---安全---自定义级别---将ActiveX控件和插件前3个选项设置为启用
f unction browseFolder(path) {
t ry {
var Message = "\u8bf7\u9009\u62e9\u6587\u4ef6\u5939"; //选择框提示信息
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(); // 返回 FolderItems 对象
Folder = Folder.item(); // 返回 Folderitem 对象
Folder = Folder.Path; // 返回路径
if (Folder.charAt(Folder.length - 1) != "") {
Folder = Folder + "";
}
document.getElementByIdx_x(path).value = Folder;
return Folder;
}
} catch (e) {
;
}
}
< /script>

你可能感兴趣的:(Html/Css)