-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcart.html
56 lines (51 loc) · 1.73 KB
/
cart.html
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
<!DOCTYPE html>
<html>
<head>
<title>Cart</title>
<script>
function one() {
var a = parseFloat(document.f.t2.value);
var b = parseFloat(document.f.t3.value);
document.f.a1.value = a * b;
}
function two() {
var a = parseFloat(document.f.t5.value);
var b = parseFloat(document.f.t6.value);
document.f.a2.value = a * b;
}
function add() {
var s1 = parseFloat(document.f.a1.value);
var s2 = parseFloat(document.f.a2.value);
document.f.a3.value = s1 + s2;
}
</script>
</head>
<body>
<form name="f">
<table width="100%" border="1" bordercolor="blue">
<tr>
<th>Book name</th>
<th>Price</th>
<th>Quantity</th>
<th>Amount</th>
</tr>
<tr>
<td><input type="text" name="t1" value="" /></td>
<td>Rs <input type="text" name="t2" value="" /></td>
<td><input type="text" name="t3" value="" /></td>
<td>Rs <input type="text" name="a1" value="" onfocus="one()" /></td>
</tr>
<tr>
<td><input type="text" name="t4" value="" /></td>
<td>Rs <input type="text" name="t5" value="" /></td>
<td><input type="text" name="t6" value="" /></td>
<td>Rs <input type="text" name="a2" value="" onfocus="two()" /></td>
</tr>
<tr>
<td colspan="3" align="right"><b>Total Amount</b></td>
<td>Rs <input type="text" name="a3" value="" onfocus="add()" /></td>
</tr>
</table>
</form>
</body>
</html>