zoukankan      html  css  js  c++  java
  • 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;
                    }

  • 相关阅读:
    递归和消去递归
    Time complexity analysis of algorithms
    algorithms中计算时间的渐近表示
    OAuth认证协议原理分析及同步消息到Twitter和Facebook使用方法
    javascript实现URL编码与解码
    before伪类的超有用应用技巧——水平菜单竖线分隔符
    在线工具(转)
    程序员小抄大全
    Web设计的速查卡(转)
    一个简单的AJAX示例(转)
  • 原文地址:https://www.cnblogs.com/johnblogs/p/6002798.html
Copyright © 2011-2022 走看看