js動態增刪附件


<!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='#' οnclick='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>

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章