- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title>无标题文档</title>
- <style type="text/css">
- table td a:link,table td a:visited{
- text-decoration:none;
- color:#0FF;
- }
- table,table td{
- border:#0FF 1px solid;
- }
- </style>
- <script type="text/javascript">
- var count = 0;
- function addFile()
- {
- count = ++count;
- var tabNode = document.getElementsByTagName("table")[0];
- var trNode = tabNode.insertRow(count);
- trNode.id = "tr_"+count;
- //alert(trNode.tagName);
- var tdNode_file = trNode.insertCell();
- var tdNode_del = trNode.insertCell(1);
-
- tdNode_file.innerHTML = "<input type='file'/>";
- tdNode_del.innerHTML = "<a href='javascript: void(0)' onclick='delFile("+count+")'/>删除附件"+count+"</a>"
- }
- function delFile(x)
- {
- var ids = "tr_"+x;
- var trNode = document.getElementById(ids);
- var tabNode = trNode.parentNode;
- tabNode.removeChild(trNode);
- }
- </script>
- </head>
- <body>
- <table>
- <tr>
- <td>
- <a href="javascript:void(0)" onclick="addFile()">添加附件</a>
- </td>
- </tr>
- </table>
- </body>
- </html>
复制代码 |
|