JS打开Windows资源管理器,让用户选择一个文件,然后打开该文件。我想默认它每次都在同一个文件夹中查找。
<html>
<head>
<script type="text/javascript">
function getFilename()
{
<!-- open the file -->
var thefile = document.getElementById('thefile');
window.open(thefile.value,'mywindow','width=400,height=200')
}
</script>
</head>
<body>
<form>
<!-- get the filename -->
<p>FCT scanned files search screen</P>
<p>Click Browse to select file</P>
<input type="file" id="thefile" onchange="getFilename()" />
</form>
</body>
</html>
答案 0 :(得分:1)
您正在寻找的是不可能的(至少在IE中)。出于安全原因,您无法使用文件输入字段更改任何内容。您甚至无法通过脚本更改输入字段的值(仅通过对话框窗口)。
您可以通过在Windows注册表中攻击某些内容来为自己的浏览器执行此操作,但我完全不确定。
的Gr。瑞克