js选择文件夹路径

 该方法只支持IE.

语法:
strDir=Shell.BrowseForFolder(Hwnd,Title,Options,[RootFolder])
参数:
Hwnd:包含对话框的窗体句柄(handle),一般设置为0
Title:将在对话框中显示的说明,为字符串
Options:使用对话框的特殊方式,为长整数,一般设置为0
RootFolder:(可选的),用来设置浏览的最顶层文件夹,缺省时为“桌面”,可以将其设置为一个路径或“特殊文件夹常数”

For example:

     try {
                    //Shell.BrowseForFolder(Hwnd, Title,Options, [RootFolder])
                    var filePath;
                    var objSrc = new ActiveXObject("Shell.Application").BrowseForFolder(0, '请选择保存路径', 0, '');
                    if (objSrc != null) {
                        filePath = objSrc.Items().Item().Path;
                        if (filePath.charAt(0) == ':') {
                            alert('请选择文件夹.');
                            return;
                        }
                    }
                } catch (e) {
                    alert(e + '请设置IE,Internet选项-安全-自定义级别-将ActiveX控件和插件前3个选项设置为启用,然后再尝试。');
                    return;
                }

原文地址:https://www.cnblogs.com/johnblogs/p/6002798.html