亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

jQuery動(dòng)態(tài)添加 input type=file的實(shí)現(xiàn)代碼

 更新時(shí)間:2012年06月14日 19:23:44   作者:  
有時(shí)候需要在頁面上允許用戶上傳多個(gè)文件,個(gè)數(shù)由用戶自己決定,個(gè)數(shù)多了也可以刪除,使用jQuery可以很簡(jiǎn)單的實(shí)現(xiàn)這個(gè)功能

復(fù)制代碼 代碼如下:

<form id="fileForm" action="" method="post" enctype="multipart/form-data">
<tr>
<td>
<input type="file" name="file"><input type="button" id="addButon" value="Add" onclick="add()">
</td>
</tr>
</form>

核心jquery代碼
復(fù)制代碼 代碼如下:

//添加一行<tr>
function add() {
var content = "<tr><td>";
content += "<input type='file' name='file'><input type='button' value='Remove' onclick='remove(this)'>";
content += "</td></tr>"
$("#fileForm").append(content);
}
//刪除當(dāng)前行<tr>
function remove(obj) {
$(obj).parent().parent().remove();
}


腳本之家整理的在線演示:http://demo.jb51.net/jquery/juqery_input/

相關(guān)文章

最新評(píng)論