calculator.html
1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="utf-8">
<title>jQuery Test</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script src="calculator.js"></script>
<link rel="stylesheet" href="calculator.css">
</head>
<body>
<div>
<table id="tab" border="1">
<thead>
<tr>
<th></th><th>상품명</th><th>단가</th><th>개수</th><th>가격</th>
</tr>
</thead>
<tbody></tbody>
<tfoot>
<tr>
<th colspan="4">합계</th>
<th><span id="sum" class="price"></span></th>
</tr>
</tfoot>
</table>
<input type="button" value="물품추가" id="add">
<input type="button" value="물품삭제" id="del">
</div>
</body>
</html>
<script id="rowTemplate" type="text/template">
<tr>
<td><input type='checkbox'></td>
<td><input type='text' size='15'></td>
<td><input type='text' size='10' class='unit-price' onchange='recalculate();'></td>
<td>
<select class='qty' onchange='recalculate();'>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
<option>6</option>
<option>7</option>
<option>8</option>
<option>9</option>
<option>10</option>
</select>
</td>
<td align="right"><span class='price'></span></td>
</tr>
</script>
<script type="text/javascript">
$(function() {
initCalculator();
});
</script>