我通过javascript创建了一个输入文件类型。
输入类型文件按我的预期生成,除了我看不到浏览按钮。
我搜索了输入文件类型 css 样式,但我看到的只是如何自定义
浏览器按钮。下面是我的屏幕的样子。
通常,文件类型应该显示为第二个,但是当我得到第一个时
在 javascript 中生成文件类型。下面是我的代码。
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<style>
.uploadForm{
type:file; position:relative;
}
#addBtn{
width:100px; height:20px;
}
</style>
<script>
function addMoreFiles(){
var fileForm = document.createElement('input');
var addButton = document.createElement('button');
addButton.setAttribute('onclick', "addMoreFiles()");
addButton.setAttribute('id', "addBtn");
fileForm.className = 'uploadForm';
document.getElementById('uploadDiv').appendChild(fileForm);
document.getElementById('uploadDiv').appendChild(addButton);
}
</script>
</head>
<body onload="addMoreFiles()">
<form name="frmname" method="post" enctype="multipart/form-data" action="./ViewPage.jsp">
file<br>
<div id="uploadDiv"></div>
<br>
<input type="file" name="uploadFile"><br>
<input type="submit" value="upload"><br>
</form>
</body>
</html>
谁能告诉我我做错了什么?提前致谢。