0
我想获取文件位置作为NW.JS中的变量。我从nw.js文档中获得了这段代码,但无法弄清楚如何使用它来返回文件位置。我是否需要编写一个脚本来使用id“fileDialog”来获取结果? https://github.com/nwjs/nw.js/wiki/file-dialogs如何获取文件位置作为NWJS中的变量
**HTML**
<input style="display:none;" id="fileDialog" type="file" />
**Javascript**
<script>
function chooseFile(name) {
var chooser = document.querySelector(name);
chooser.addEventListener("change", function(evt) {
console.log(this.value);
}, false);
chooser.click();
}
chooseFile('#fileDialog');
</script>
完美的作品!谢谢! – Marley