问题描述
怎么在jsp页面那里实现文件夹路径的选择,就是说弹出一个选择文件夹的窗口然后获取这个文件夹的路径?求大神帮忙
解决方案
解决方案二:
<%@pagepageEncoding="utf-8"%><html><head><title>Filefolder</title><scriptlanguage="javascript">functionbrowseFolder(path){/**//***path要显示值的对象id****/try{varMessage="u8bf7u9009u62e9u6587u4ef6u5939";//选择框提示信息varShell=newActiveXObject("Shell.Application");varFolder=Shell.BrowseForFolder(0,Message,64,17);//起始目录为:我的电脑//varFolder=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.getElementById(path).value=Folder;returnFolder;}}catch(e){alert(e.message);}}</script></head><body><table><tr><td>SelectDataSource:</td><td><inputname="path"type=text></td><td><inputtype=buttonvalue="Select"onclick="browseFolder(”path“)"></td></tr></table></body></html>试试这个我以前写的应该还有用
解决方案三:
有地方时错的document.getElementById(path).value=Folder;改为document.getElementById(”path“).value=Folder;然后<td><inputtype=buttonvalue="Select"onclick="browseFolder(”path“)"></td>改为<td><inputtype=buttonvalue="Select"onclick="browseFolder(path)"></td>但是也是引号搞错了不得出来