关于在js中打开windows文件夹选择框? Shell.Application需要的权限已经超过了一个网页所能做的事几乎所有SHELL都是没权限的 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 我查了一下写成如下就不会出错了:var objSrc = new ActiveXObject("Shell.Application").BrowseForFolder(0,'请选择导出路径:',0x0040,0x11); //0,'' 后面两个参数表示什么意思呢? BrowseForFolder(Hwnd,title,Options,[RootFolder])上网查了一下参数含义如下: Options,浏览方式,见下:|-P 0x0001 For finding a folder to start document searchingE{vDe 0x0002 For starting the Find Computerrzksq^ 0x0004 对话框加宽 0x0008 确定按钮变灰失效>A3v,W 0x0010 在对话框顶部加入编辑框~=#g[1 0x0020 insist on valid result (or CANCEL)ge01 0x1000 确定按钮变灰失效9< 0x2000 可选当前文件,不包括子目录文件,确定按钮变灰失效,(可同时选0x0001使确定按钮有效)F 0x4000 浏览所有项,可选文件或文件夹 RootFolder,起始根目录,可选项,可以自己指定目录字符串,也可以是系统目录的数字表示,数字含义见下:G 0x0000 桌面 0x0001 IE浏览器hrzo 0x0002 C:\WINDOWS\Start Menu\Programs目录m 0x0003 控制面板j} 0x0004 打印机Ln/( 0x0005 我的文档0sm 0x0006 收藏U 0x0007 启动*oyh 0x0008 Recent文档9OB 0x0009 发送到5cO 0x000a 回收站,\a 0x000b 开始菜单ZKS 0x000c 桌面(打开在我的电脑) 0x0010 C:\WINDOWS\Desktop桌面目录K+*fg 0x0011 我的电脑(包括所有驱动器)N`T 0x0012 整个网络Y5Swh 0x0013 NetHood%O~64 0x0014 字体目录(ObtHd 0x0015 C:\WINDOWS\ShellNew目录Byo!)v 0x001a C:\WINDOWS\Application Data目录q 0x001b printHoodS]pW2 0x0020 C:\WINDOWS\Temporary Internet Files目录 0x0021 cookie目录 0x0022 IE浏览历史 可以,是一个html文件:<html><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><meta name="GENERATOR" content="Microsoft FrontPage 6.0"><meta name="ProgId" content="FrontPage.Editor.Document"><title>选择文件夹</title><script>//----------------------------------------------------------------------function pageInit(){ var vsCaption= window.dialogArguments; if (vsCaption!= null) CaptionTD.innerText= vsCaption; window.returnValue= null;}//----------------------------------------------------------------------function OKButton_Click(){ window.returnValue= textPath.value; window.close();}//----------------------------------------------------------------------function CancelButton_Click(){ window.returnValue= null; window.close();}//----------------------------------------------------------------------function chooseFolder(){ var savePath; var objSrc = new ActiveXObject("Shell.Application").BrowseForFolder(0,'请选择导出路径:',0x0001,0x0011); //0,'' if(objSrc != null){ savePath = objSrc.Items().Item().Path; document.all.savePath.value = savePath; } }//----------------------------------------------------------------------</script></head><body bgcolor="#C0C0C0" onload="pageInit();"><table border="0" width="100%"> <tr style="font-size:1pt"> <td width="2%"> </td> <td width="48%"> </td> <td width="2%"> </td> </tr> <tr style="font-size:9pt"> <td width="2%"></td> <td width="48%" id="CaptionTD">请选择文件夹: </td> <td width="2%"></td> </tr> <tr> <td width="2%"> </td> <td width="48%"><input type='text' id="textPath" size='30' name='savePath' /><input type="button" id="FileSelectInput" name="choosefolderbutton" value="选择..." onclick="chooseFolder()"> </td> <td width="2%"> </td> </tr> <tr> <td width="2%"> </td> <td width="48%"> </td> <td width="2%"> </td> </tr> <tr style="text-align:center;"> <td width="2%"> </td> <td width="48%"><input type="button" id="OKButton" value=" 确定 " style="font-size:9pt; border-width:1;" onclick="OKButton_Click();"><input type="button" id="CancelButton" value=" 取消 " style="font-size:9pt; border-width:1;" onclick="CancelButton_Click();"></td> <td width="2%"> </td> </tr> <tr style="font-size:1pt"> <td width="2%"> </td> <td width="48%"> </td> <td width="2%"> </td> </tr></table></body></html> 我运行了一下你的文件提示:automation 服务器不能创建对象 可以用document.createElement( "tag名称" ) 来用javascript创建一个文件上传对象,然后再用创建的对象 EYESPACE() 你运行提示没有权限,需要设置ie的安全级别; 将js脚本的代码打乱 数组问题! 关于一个全选的问题 jsp中取复选框的值的问题 firefox下无法用childNodes[0].nodeValue正常读取节点的值 html表格的问题 关于ADODB.Stream简单的问题 关于javascript调用txt并进行字符替换的问题 急请问,javascript的显示问题。 请帮忙! 从别的网址连接到我的网站,怎么在我的网站上判断连接过来的网址? 大家帮忙看看为什么我的代码没有运行 求一有点烦的正则表达式
var objSrc = new ActiveXObject("Shell.Application").BrowseForFolder(0,'请选择导出路径:',0x0040,0x11); //0,''
后面两个参数表示什么意思呢?
上网查了一下参数含义如下:
Options,浏览方式,见下:|-P
0x0001 For finding a folder to start document searchingE{vDe
0x0002 For starting the Find Computerrzksq^
0x0004 对话框加宽
0x0008 确定按钮变灰失效>A3v,W
0x0010 在对话框顶部加入编辑框~=#g[1
0x0020 insist on valid result (or CANCEL)ge01
0x1000 确定按钮变灰失效9<
0x2000 可选当前文件,不包括子目录文件,确定按钮变灰失效,(可同时选0x0001使确定按钮有效)F
0x4000 浏览所有项,可选文件或文件夹
RootFolder,起始根目录,可选项,可以自己指定目录字符串,也可以是系统目录的数字表示,数字含义见下:G
0x0000 桌面
0x0001 IE浏览器hrzo
0x0002 C:\WINDOWS\Start Menu\Programs目录m
0x0003 控制面板j}
0x0004 打印机Ln/(
0x0005 我的文档0sm
0x0006 收藏U
0x0007 启动*oyh
0x0008 Recent文档9OB
0x0009 发送到5cO
0x000a 回收站,\a
0x000b 开始菜单ZKS
0x000c 桌面(打开在我的电脑)
0x0010 C:\WINDOWS\Desktop桌面目录K+*fg
0x0011 我的电脑(包括所有驱动器)N`T
0x0012 整个网络Y5Swh
0x0013 NetHood%O~64
0x0014 字体目录(ObtHd
0x0015 C:\WINDOWS\ShellNew目录Byo!)v
0x001a C:\WINDOWS\Application Data目录q
0x001b printHoodS]pW2
0x0020 C:\WINDOWS\Temporary Internet Files目录
0x0021 cookie目录
0x0022 IE浏览历史
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 6.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>选择文件夹</title><script>
//----------------------------------------------------------------------
function pageInit(){
var vsCaption= window.dialogArguments;
if (vsCaption!= null) CaptionTD.innerText= vsCaption;
window.returnValue= null;
}
//----------------------------------------------------------------------
function OKButton_Click(){
window.returnValue= textPath.value;
window.close();
}
//----------------------------------------------------------------------
function CancelButton_Click(){
window.returnValue= null;
window.close();
}
//----------------------------------------------------------------------
function chooseFolder(){
var savePath;
var objSrc = new ActiveXObject("Shell.Application").BrowseForFolder(0,'请选择导出路径:',0x0001,0x0011); //0,''
if(objSrc != null){
savePath = objSrc.Items().Item().Path;
document.all.savePath.value = savePath;
}
}
//----------------------------------------------------------------------
</script>
</head><body bgcolor="#C0C0C0" onload="pageInit();"><table border="0" width="100%">
<tr style="font-size:1pt">
<td width="2%"> </td>
<td width="48%"> </td>
<td width="2%"> </td>
</tr>
<tr style="font-size:9pt">
<td width="2%"></td>
<td width="48%" id="CaptionTD">请选择文件夹:
</td>
<td width="2%"></td>
</tr>
<tr>
<td width="2%"> </td>
<td width="48%"><input type='text' id="textPath" size='30' name='savePath' /><input type="button" id="FileSelectInput" name="choosefolderbutton" value="选择..." onclick="chooseFolder()"> </td>
<td width="2%"> </td>
</tr>
<tr>
<td width="2%"> </td>
<td width="48%"> </td>
<td width="2%"> </td>
</tr>
<tr style="text-align:center;">
<td width="2%"> </td>
<td width="48%"><input type="button" id="OKButton" value=" 确定 " style="font-size:9pt; border-width:1;" onclick="OKButton_Click();"><input type="button" id="CancelButton" value=" 取消 " style="font-size:9pt; border-width:1;" onclick="CancelButton_Click();"></td>
<td width="2%"> </td>
</tr>
<tr style="font-size:1pt">
<td width="2%"> </td>
<td width="48%"> </td>
<td width="2%"> </td>
</tr>
</table>
</body></html>
提示:
automation 服务器不能创建对象