显示文件夹

<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
    <script  type="text/javascript">
       function browseFolder(path)
       {
          try
         {
          
            var Message = "\u8bf7\u9009\u62e9\u6587\u4ef6\u5939"; //选择框提示信息
            var Shell = new ActiveXObject("Shell.Application");
            var Folder = Shell.BrowseForFolder(0, Message, 64, 17);
                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);
            }
        }
 
    </script>
</head>
<body>
    <form id="form1" runat="server">
        <div>
            <input type="button" onclick="browseFolder('txtRTFPath')" value="Browse..." />
            <asp:TextBox ID="txtRTFPath" runat="server" Width="200px"></asp:TextBox>
        </div>
    </form>
</body>
</html>

posted on 2010-03-26 17:08  Gsun  阅读(135)  评论(0编辑  收藏  举报

导航