Multi Upload Functions [任意增减控件组-eg:多附件的添加.etc]
<!-- #BeginEditable "script" -->
<script language="javascript" type="text/javascript">
<!--
//----- Multi Upload Functions -------------------------------------------------
var isIE = (navigator.userAgent.indexOf("MSIE") != -1);
var fileIndex = 0;
function addFile() {
var spanId = "filespan";
var fileId = "uploadfile" + (fileIndex++);
addInputFile(spanId, fileId);
}
function addInputFile(spanId, fileId) {
var span = document.getElementById(spanId);
if (span != null) {
var divObj = document.createElement("div"), fileObj, delObj;
divObj.id = fileId;
divObj.style.height='22';
if (isIE) {
fileObj = document.createElement("<input type=file onchange='javascript:alert('');'>");
delObj = document.createElement("<input type=button onclick=delInputFile('" + spanId + "','" + fileId + "')>");
} else {
fileObj = document.createElement("input");
fileObj.type = "file";
fileObj.setAttribute("onchange", "javascript:alert('');", 0);
delObj = document.createElement("input");
delObj.type = "button";
delObj.setAttribute("onclick", "delInputFile('" + spanId + "','" + fileId + "')", 0);
}
fileObj.name = fileId;
fileObj.size = "50";
fileObj.className = "AllBorderW";
delObj.value = "删除";
divObj.appendChild(fileObj);
divObj.appendChild(document.createTextNode(" "));
divObj.appendChild(delObj);
span.appendChild(divObj);
}
}
function delInputFile(spanId, fileId) {
var span = document.getElementById(spanId);
var divObj = document.getElementById(fileId);
if (span != null && divObj != null) {
span.removeChild(divObj);
}
}
//-->
</script>
<!-- #EndEditable -->
<table>
<tr>
<td nowrap id="filespan">
<input type="button" onclick="addFile()" value="添加" id="btnAdd" />
</tr>
</table>
<script language="javascript" type="text/javascript">
<!--
//----- Multi Upload Functions -------------------------------------------------
var isIE = (navigator.userAgent.indexOf("MSIE") != -1);
var fileIndex = 0;
function addFile() {
var spanId = "filespan";
var fileId = "uploadfile" + (fileIndex++);
addInputFile(spanId, fileId);
}
function addInputFile(spanId, fileId) {
var span = document.getElementById(spanId);
if (span != null) {
var divObj = document.createElement("div"), fileObj, delObj;
divObj.id = fileId;
divObj.style.height='22';
if (isIE) {
fileObj = document.createElement("<input type=file onchange='javascript:alert('');'>");
delObj = document.createElement("<input type=button onclick=delInputFile('" + spanId + "','" + fileId + "')>");
} else {
fileObj = document.createElement("input");
fileObj.type = "file";
fileObj.setAttribute("onchange", "javascript:alert('');", 0);
delObj = document.createElement("input");
delObj.type = "button";
delObj.setAttribute("onclick", "delInputFile('" + spanId + "','" + fileId + "')", 0);
}
fileObj.name = fileId;
fileObj.size = "50";
fileObj.className = "AllBorderW";
delObj.value = "删除";
divObj.appendChild(fileObj);
divObj.appendChild(document.createTextNode(" "));
divObj.appendChild(delObj);
span.appendChild(divObj);
}
}
function delInputFile(spanId, fileId) {
var span = document.getElementById(spanId);
var divObj = document.getElementById(fileId);
if (span != null && divObj != null) {
span.removeChild(divObj);
}
}
//-->
</script>
<!-- #EndEditable -->
<table>
<tr>
<td nowrap id="filespan">
<input type="button" onclick="addFile()" value="添加" id="btnAdd" />
</tr>
</table>