Window.onload 表单未加载

on Window.onload form is not loading

Window.onload 表单未加载 我的代码是:

<script language="javascript" type="text/javascript"> 
window.onload=formOnWindowLoad();
function formOnWindowLoad(){
setTimeout(function(){document.getElementById('fileUploadForm');},3000);
}
</script>
</head>
<body >
<br>Select a file to upload: <br />
<form id="fileUploadForm" action="fileLocalUpload.htm?eId=${eId}&tId=${tId}" method="post"enctype="multipart/form-data"> 
<input id="uploadFileOnRemoteServer" type="file" name="uploadingFile" />
<br />
<input type="submit" value="Upload File" />
</form>

我想要 select 框 window onload

您的功能正在运行,但您没有对该功能执行任何操作。你只是得到了元素而已。

如果您想在一段时间后打开文件上传,此代码适合您。为了您的理解,我已经保持警惕。

window.onload=formOnWindowLoad();
function formOnWindowLoad(){
 setTimeout(function(){
 document.getElementById('uploadFileOnRemoteServer').click()},500);
}
<br>Select a file to upload: <br />
<form id="fileUploadForm" action="fileLocalUpload.htm?eId=${eId}&tId=${tId}" method="post"enctype="multipart/form-data"> 
<input id="uploadFileOnRemoteServer" type="file" name="uploadingFile" />
<br />
<input type="submit" value="Upload File" />
  
</form>

这适用于 you.If,即您的 requirement.It 将在 3 秒后打开。

Go through this link...