- <script language="JavaScript">
- var inputs = 0;
- function addFile(){
- var table = document.getElementById('addFile');
- var tr = document.createElement('TR');
- var td1 = document.createElement('TD');
- var td2 = document.createElement('TD');
- var inp = document.createElement('INPUT');
- if(inputs>0){
- var img = document.createElement('IMG');
- img.setAttribute('src', 'images/admin_delete.png');
- img.onclick = function(){
- removeContact(tr);
- }
- td2.appendChild(img);
- }
- inp.setAttribute("Name", "files[]");
- inp.setAttribute("type", "file");
- inp.setAttribute("size", "150");
- /*td1.setAttribute("class", "AddTopicFiles"); */
- td1.setAttribute("width", "700px");
- table.appendChild(tr);
- tr.appendChild(td1);
- tr.appendChild(td2);
- td1.appendChild(inp);
- inputs++;
- }
- function removeContact(tr){
- tr.parentNode.removeChild(tr);
- }
- --></script>
- <form name="AddTopic" action="index.php" method="post" enctype="multipart/form-data">
- <table>
- <tbody id="addFile">
- <tr>
- <td colspan="2"><a href="javascript:addFile();">Добавить файл</a></td>
- </tr>
- </tbody>
- </table>
- <input class="AddTopicControl" name="AddTopic" type="submit" value="Добавить">
- </form>