من می خواهم کلید delete با فشردن کلید add more به هر سطر اصافه شود و با فشردن کلید delete همان سطر حذف گردد
<body>
<form id="form1" runat="server">
<div>
<p>File Uploader</p>
</div>
<p id="upload-area" style=" direction: ltr;">
<%--http://www.flightpedia.org/convert/1048576000000-bytes-to-megabytes.html--%> <%--1 MB = 1048576 B => 200 * 1048576 = 209715200--%> <%--1 MB = 1048576 B => 1000000 * 1048576 = 1048576000000--%> <%--<span>File 1 : </span><input id="File2" type="file" size="60" maxlength="1048576000000 " tabindex="0" runat="server" /><span> | </span>--%>
<span>File 1 : </span><input id="File1" type="file" size="60" tabindex="0" runat="server" /><span> | </span>
<span>File 1 Title : </span><input id="txt1" name="txt1" type="text" size="40" tabindex="1" runat="server" visible="False" /><asp:Button ID="ButtonDelete" runat="server" Text="Delete" />
</p>
<span id="msg" runat="server"></span>
<input id="btnAddMore" type="button" value="Add more..."
onclick="add()" />
<asp:Button ID="btnUpload" runat="server"
Text="Upload Now" OnClick="btnUpload_Click" />
</div>
</form>
<script type="text/javascript">
function add() {
if (!document.getElementById || !document.createElement)
return false;
var uploadArea = document.getElementById("upload-area");
if (!uploadArea)
return;
var newLine = document.createElement("br");
uploadArea.appendChild(newLine);
if (!add.lastAssignedId)
add.lastAssignedId = 2;
//----------------------------------------------------
// create new span for fileupload
var fuSpan = document.createElement('span');
var fuSpanText = document.createTextNode('File ' + add.lastAssignedId + ' : ');
fuSpan.appendChild(fuSpanText);
// create new fileupload control
var newUploadBox = document.createElement('input');
// set property for input ( fileupload )
newUploadBox.type = 'file';
newUploadBox.size = '60';
// set other att
newUploadBox.setAttribute('id', 'FileUpload' + add.lastAssignedId);
newUploadBox.setAttribute('name', 'FileUpload:' + add.lastAssignedId);
//newUploadBox.setAttribute('maxlength', '209715200');
newUploadBox.setAttribute('maxlength', '1073741824');
newUploadBox.setAttribute('tabindex', add.lastAssignedId);
//----------------------------------------------------
// create new span for separator
var seSpan = document.createElement('span');
var seSpanText = document.createTextNode(' | ');
seSpan.appendChild(seSpanText);
//----------------------------------------------------
// create new span for title
var tiSpan = document.createElement('span');
var tiSpanText = document.createTextNode('File ' + add.lastAssignedId + ' Title : ');
tiSpan.appendChild(tiSpanText);
// create new textbox for title
var newTextBox = document.createElement('input');
// set property for input ( textbox )
newTextBox.type = 'text';
newTextBox.size = '40';
// set other att
newTextBox.setAttribute('id', 'txt' + add.lastAssignedId);
newTextBox.setAttribute('name', 'txt' + add.lastAssignedId);
newTextBox.setAttribute('tabindex', add.lastAssignedId + 1);
//----------------------------------------------------
//Myself
//----------------------------------------------------
// create new span for title
var bdSpan = document.createElement('span');
var newDeletButton = document.createElement('Button');
// set property for Delete ( Button )
newDeletButton.type = 'Button';
// set other att
newDeletButton.setAttribute('id', 'ButtonDelete' + add.lastAssignedId);
newDeletButton.setAttribute('text', 'Delete' + add.lastAssignedId);
newDeletButton.setAttribute('tabindex', add.lastAssignedId + 1);
//----------------------------------------------------
uploadArea.appendChild(fuSpan);
uploadArea.appendChild(newUploadBox);
uploadArea.appendChild(seSpan);
//uploadArea.appendChild(tiSpan);
//uploadArea.appendChild(newTextBox);
uploadArea.appendChild(bdSpan);
add.lastAssignedId++;
}
</script>
</body>
و دستور
uploadArea.appendChild(bdSpan);
را نیز اضافه کرده ام ولی نمی دانم چرا کار نمی کند