<script>
$(function() {
//增加上传
var addli = function() {
var linum = parseInt($(".pic-wrap li.upload").length);
$('.pic-wrap ul').append('<li class="upload"><input name="FileUpload' + (linum + 1) + '" type="file" id="FileUpload' + (linum + 1) + '" class="multi"/>图片名称:<input type="text" class="text2" id="ImgTitle' + (linum + 1) + '" name="ImgTitle' + (linum + 1) + '"/>'); }; //增加“添加”按钮并清除原来的
var move_btn = function() {
$(".pic-wrap li.upload:last").append('<input class="add_up" type="button" value="添加" />')
.find('.add_up').bind('click', function() {
addli();
move_btn();
move_btn2();
})
.parent('li.upload').siblings().find('.add_up').remove();
}; //移动“上传”按钮到最后
var move_btn2 = function() {
$('.upbtn').insertAfter(".pic-wrap li.upload:last")
};
$('.add_up').click(function() {
addli();
move_btn();
move_btn2();
});
});
</script>
<ul>
<li class="upload">
<input id="File1" name="FileUpload1" type="file" class="multi"/>产品名称:
<input type="text" class="text2" id="ImgTitle1" name="ImgTitle1"/>
<input class="add_up" type="button" value="添加" />
<input type="hidden" id="fileSize" name="fileSize" value="1"/>
</li>
</ul>