直接搜索当前的所有html文件,并在div
标记中添加超链接..
它在IE中完美无缺......但它在Firefox和Chrome中无法运行..任何人都可以帮助我....
<script type="text/javascript">
function getCurrentDirectory() {
var fso = new ActiveXObject("Scripting.FileSystemObject");
path = unescape(document.location);
path = path.substring(8, path.lastIndexOf("/") + 1);
return path;
}
function ShowFolderFileList() {
var fso, f, f1, fc, s, temp, Extention, fileName, temp2, filePath;
folderspec = getCurrentDirectory();
fso = new ActiveXObject("Scripting.FileSystemObject");
f = fso.GetFolder(folderspec);
fc = new Enumerator(f.files);
s = "";
for (; !fc.atEnd(); fc.moveNext()) {
filePath = "" + fc.item() + "";
fileName = fc.item().name;
temp = "" + fileName + ""
Extention = (temp.lastIndexOf(".") > -1) ? temp.slice(temp.lastIndexOf(".") + 1).toLowerCase() : "*";
if (Extention == "html" || Extention == "htm") {
s += "<a href=\"" + fileName + "\" target=\"_blank\">" + temp.replace("." + Extention, "") + "</a> <br>";
}
}
outPut.innerHTML = s;
}
</script>
在html中
<div id="outPut">
</div>
任何人都在努力....
答案 0 :(得分:2)
Firefox does not support ActiveX technology for multiple reasons.
Chrome也是如此。
如果您确实需要文件系统访问权限,那么Java Web Start之类的内容就是替代方案。