嗨,我正在使用http://www.fyneworks.com/jquery/multiple-file-upload/作爲多個上傳文件。 但我也需要一些動態的file
上傳器的相同功能。所以我爲此寫了一個函數addElement()
。問題是動態元素正在創建,但多個上傳功能無法正常工作。 具有多個上傳文件的動態元素
<title>Add Element</title>
<script language="javascript">
this.num = 1;
function addElement(){
$top = document.getElementById('top');
newId = document.createElement('div');
id = 'my'+this.num;
newId.setAttribute('id', id);
newId.innerHTML = "<input type='file' name='DocumentFiles2' class='multi' />";
$top.appendChild(newId);
this.num++;
}
function removedThis(id){
var d = document.getElementById('top');
d.removeChild(id);
}
</script>
</head>
<body>
<input type='file' name='DocumentFiles[]' class='multi' /><!-- This one is working -->
<input type="button" name="button" value="Add Element" onclick="addElement()" />
<div id="top" ></div>
</body>
</html>
有任何替代辦法做到這一點還是讓這個工作?
哪裏是你上傳的代碼。你需要上傳一個循環 – polin 2013-02-11 06:59:50