js动态增删附件
来源:互联网 发布:python 读入整个文件 编辑:程序博客网 时间:2024/05/01 18:21
<!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><title>附件上传</title><link href="css/css.css" rel="stylesheet" type="text/css" /><link href="css/div.css" rel="stylesheet" type="text/css" /> <style type="text/css"> a { color: #178DE4; text-decoration: underline; } a:hover { color: #178DE4; text-decoration: underline; } a:link{ color:#178DE4; text-decoration:none; </style> <script type="text/javascript"> function addRow() { var table=document.getElementById("table"); var i=table.rows.length; var row=table.insertRow(i-1); var cell1=row.insertCell(); cell1.setAttribute("align","left") cell1.innerHTML="<input type='file' name='file' /> <a href='#' onclick='deleteRow(this)' style='font-size: 13px'> 删 除</a>"; } //删除一行 function deleteRow(obj) { obj.parentNode.parentNode.parentNode.removeChild(obj.parentNode.parentNode); } </script><link href="../App_Themes/Skin1/skin.css" type="text/css" rel="stylesheet" /></head><body> <div> <div class="top"> </div> <div id="header"> </div> <div id="contain"> <div class="contain_top"> <ul> <li class="c">上传附件</li> </ul> </div> <div class="contain_table"> <form id="form" method="post" enctype="multipart/form-data"> <table id="table" width="100%" border="0" cellpadding="0" class="nb"> <tr> <td align="left" valign="top"> <input type="file" name="file" /> <a href="javascript:addRow()" style="font-size: 13px">添 加 </a> </td> </tr> <tr> <td align="left"> <input type="submit" value=" 上 传 " name="submit" /> </td> </tr> </table> </form> </div> </div> </div></body></html>