jsp中单击一个按钮,就会弹出显示本地磁盘文件的对话框,怎么实现啊?
2个回答
展开全部
function chooseDir() {
var Folder = new ActiveXObject("Shell.Application").BrowseForFolder(0,
"请选择路径", 0, "")
if (Folder != null) {
Folder = Folder.items(); // 返回 FolderItems 对象
Folder = Folder.item(); // 返回 Folderitem 对象
Folder = Folder.Path; // 返回路径
if (Folder.charAt(Folder.length - 1) != "") {
Folder = Folder + "";
}
//var substr=Folder.substring(0,2);
// var subDisk=Folder.substring(0,1);
//File fs = new File(substr);
//long freeSpace=FormetFileSize(fs.getFreeSpace());
document.getElementById('url').setAttribute('value', Folder);
//document.getElementById('disk').setAttribute('value', subDisk);
//document.getElementById('freespace').setAttribute('value', freeSpace);
return Folder;
}
}
按钮中添加onclick=" chooseDir()"
var Folder = new ActiveXObject("Shell.Application").BrowseForFolder(0,
"请选择路径", 0, "")
if (Folder != null) {
Folder = Folder.items(); // 返回 FolderItems 对象
Folder = Folder.item(); // 返回 Folderitem 对象
Folder = Folder.Path; // 返回路径
if (Folder.charAt(Folder.length - 1) != "") {
Folder = Folder + "";
}
//var substr=Folder.substring(0,2);
// var subDisk=Folder.substring(0,1);
//File fs = new File(substr);
//long freeSpace=FormetFileSize(fs.getFreeSpace());
document.getElementById('url').setAttribute('value', Folder);
//document.getElementById('disk').setAttribute('value', subDisk);
//document.getElementById('freespace').setAttribute('value', freeSpace);
return Folder;
}
}
按钮中添加onclick=" chooseDir()"
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询