02.
<script src=
"//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"
></script>
03.
<script src=
"js/jquery.datetimepicker.js"
></script>
04.
05.
<table width=
"200px"
height=
"200px"
border=
"1"
id=
"myTbl"
>
06.
<tr class=
"aa"
>
07.
<td width=
"91"
>
08.
<select id=
"pagelist"
class=
"firstTr"
>
09.
<option value=
""
>เลือก</option>
10.
<option value=
"1"
>First</option>
11.
<option value=
"2"
>Second</option>
12.
<option value=
"3"
>S</option>
13.
</select>
14.
<div id=
"1"
style=
"display:none"
>
15.
<img src=
"img/product/1.png"
width=
"200px"
/>
16.
</div>
17.
<div id=
"2"
style=
"display:none"
>
18.
<img src=
"img/product/2.png"
width=
"200px"
/>
19.
</div>
20.
<div id=
"3"
style=
"display:none"
>
21.
<img src=
"img/product/3.png"
width=
"200px"
/>
22.
</div>
23.
</td>
24.
</tr>
25.
</table>
26.
<input type=
"button"
id=
"createRows"
value=
"+"
>
27.
<script language=
"javascript"
>
28.
$(
"#pagelist"
).change(
function
(){
29.
var
viewID = $(
"#pagelist option:selected"
).val();
30.
$(
"#pagelist option"
).each(
function
(){
31.
var
hideID = $(
this
).val();
32.
$(
"#"
+hideID).hide();
33.
});
34.
$(
"#"
+viewID).show();
35.
});
36.
37.
$(
function
(){
38.
$a=1
39.
$(
"#createRows"
).click(
function
(){
40.
41.
42.
$(
".aa:eq(0)"
).clone(
true
).insertAfter(
this
)
43.
.find(
"input"
).attr(
"value"
,
""
).end()
44.
.find(
"select"
).attr(
"value"
,
""
).end()
45.
.find(
"img"
).attr(
"src"
,
"img/product/1.png"
).end()
46.
.find(
".removeRow"
).show().end()
47.
.appendTo($(
"#myTbl"
));
48.
49.
});
50.
});
51.
</script>