-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathifEx3.html
More file actions
63 lines (52 loc) · 1.88 KB
/
ifEx3.html
File metadata and controls
63 lines (52 loc) · 1.88 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
58
59
60
61
62
63
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>자바스크립트</title>
<script type="text/javascript">
var prdNo;
var prdName;
var prdPrice
var order;
var dicount;
var total;
var inputPrdNo = prompt("상품번호 입력", "1또는2 입력");
if(inputPrdNo ==1 || inputPrdNo == 2){
var inputOrder = prompt("주문수량 입력", "주문수량 입력");
//상품명, 상품가격
if(inputPrdNo=="1"){
prdName= "노트북";
prdPrice = 1200000;
}else{
prdName="운동화";
prdPrice = 100000;
}
//주문액
var orderPrice = PrdPrice * inputOrder;
//할인율
if(orderPrice >1000000) discount = 0.1;
else if(500000 <= orderPrice && orderPrice < 1000000) discount= 0.05;
else dicount=0;
total= orderPrice - (orderPrice*discount);
/* document.write("상품명: "+ prdName +"<br>");
document.write("가격: "+ prdPrice + "원" +"<br>");
document.write("주문수량: " + inputOrder +"<br>");
document.write("주문액: "+ orderPrice+ "원" +"<br>");
document.write("할인액: " + (orderPrice*discount) +"<br>");
document.write("총지불액: " + total);
}*/
document.write("상품명: "+ prdName +"<br>");
document.write("가격: "+ prdPrice.toLocaleString() + "원" +"<br>");
document.write("주문수량: " + inputOrder +"<br>");
document.write("주문액: "+ orderPrice.toLocaleString()+ "원" +"<br>");
document.write("할인액: " + (orderPrice*discount).toLocaleString() +"<br>");
document.write("총지불액: " + total.toLocaleString());
}else{
alert("잘못입력하였습니다.");
document.write("종료합니다.");
}
</script>
</head>
<body>
</body>
</html>