日期:2014-05-18 浏览次数:20705 次
//添加附件控件 function addFile(addNew) { var trAtt = document.getElementById("trAtt"); trAtt.style.display = ""; if(addNew) { var tdAttachment = document.getElementById("attachmentId"); if(tdAttachment) { var oDiv = document.createElement('div'); tdAttachment.appendChild(oDiv); var oFile = document.createElement('<input type="file" size="50" name="File" runat="server" >'); oDiv.appendChild(oFile); var oButton = document.createElement('<button onclick="removeme()">'); oButton.innerHTML = '删除'; oDiv.appendChild(oButton); // document.getElementById("appendLink").alt = '继续添加附件'; } } } //删除附件控件 function removeme() { var oDiv = event.srcElement.parentElement; if(oDiv.tagName=='DIV') { oDiv.removeNode(true); } var tdAttachment = document.getElementById("attachmentId"); window.status = tdAttachment.innerHTML; if(tdAttachment.innerHTML.length<10) { // document.getElementById("appendLink").alt = '添加附件'; var trAtt = document.getElementById("trAtt"); trAtt.style.display = "none"; } } //删除已有附件 function removeAttachment() { if(confirm("你确定要删除该附件吗?")) { var ele = event.srcElement; if(ele.attID) { //删除隐藏控件中的附件id var hfFile=document.getElementById('hfAppur'); if(hfFile) { if(hfFile.value.indexOf(ele.attID) >= 0) { hfFile.value = hfFile.value.replace(ele.attID,""); } } var trTmp = ele.parentElement; if(trTmp) trTmp.removeNode(true); var tdAttachment = document.getElementById("attachmentId"); if(tdAttachment.innerHTML.length<10) { // document.getElementById("appendLink").innerHTML = '添加附件'; var trAtt = document.getElementById("trAtt"); trAtt.style.display = "none"; } } } }