未加载 我的代码是:
<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>
我想在窗口上加载文件选择框
答案 0 :(得分:0)
您的功能正常,但您没有使用该功能。你只是得到了它的元素。
如果您想在一段时间后打开文件上传,此代码适合您。我一直警惕你的理解。
window.onload=formOnWindowLoad();
function formOnWindowLoad(){
setTimeout(function(){
document.getElementById('uploadFileOnRemoteServer').click()},500);
}
&#13;
<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>
&#13;
这适合你。如果这是你的要求。它将在3秒后打开。