1
2
3
4
5
6
7
|
<
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
>
|
1
2
3
4
5
6
7
8
9
10
11
12
|
//添加一行<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);
}
//删除当前行<tr>
function
remove(obj) {
$(obj).parent().parent().remove();
}
|