【发布时间】:2025-12-03 16:00:02
【问题描述】:
当前html / javascript 代码...
function myfunction() {
alert("hello");
document.getElementById('file').click();
}
<body onload="myfunction();">
<input type="file" id="file" />
</body>
现在显示alert,但onload事件没有点击文件,但如果我们将事件更改为onclick,则显示alert,同时点击文件。
【问题讨论】:
-
您是否尝试打开文件对话框?
-
为什么需要启动文件浏览器
onload?我在这里闻到了一股腥味……
标签: html javascript javascript jquery html