代码如下:<input type="file" name="data" id="inFile" style="display: none"/>
<button type="button" name="btn" onClick="browse()">Choose file</button><script>var timeout;function browse(){
var fileElem = document.getElementById("inFile");
fileElem.click();
timeout = setTimeout(closeWindow, 5000);
}function closeWindow(){ // 在这里做关闭文件选择窗口的操作}</script>文件选择窗口如下:
1 回答

动漫人物
TA贡献1815条经验 获得超10个赞
js本质是调用运行环境提供的接口 而不是创造接口。 按你的需求你的运行环境是浏览器。浏览器没有提供的功能就无法实现。
举个例子 你希望js执行后你桌上的咖啡杯自动碎裂 ,这可能吗?
添加回答
举报
0/150
提交
取消