From b5eafd5b2100b9e6e6d13bd77db45fff16ba5679 Mon Sep 17 00:00:00 2001 From: chicpro Date: Fri, 24 May 2013 14:30:18 +0900 Subject: [PATCH] =?UTF-8?q?=EC=88=98=EB=9F=89=20=EC=A7=81=EC=A0=91=20?= =?UTF-8?q?=EC=9E=85=EB=A0=A5=EA=B4=80=EB=A0=A8=20=EC=8A=A4=ED=81=AC?= =?UTF-8?q?=EB=A6=BD=ED=8A=B8=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- shop/item.php | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/shop/item.php b/shop/item.php index 8fb18c8c8..cef50f4c7 100644 --- a/shop/item.php +++ b/shop/item.php @@ -489,6 +489,30 @@ else }); // 수량직접입력 + $("input[name='ct_qty[]']").live("keyup", function() { + var val= $(this).val(); + + if(val != "") { + if(val.replace(/[0-9]/g, "").length > 0) { + alert("수량은 숫자만 입력해 주십시오."); + $(this).val(1); + } else { + var d_val = parseInt(val); + if(d_val < 1 || d_val > 9999) { + alert("수량은 1에서 9999 사이의 값으로 입력해 주십시오."); + $(this).val(1); + } else { + var stock = parseInt($(this).closest("li").find("input[name='io_stock[]']").val()); + if(d_val > stock) { + alert("재고수량 보다 많은 수량을 구매할 수 없습니다."); + $(this).val(stock); + } + } + } + + price_calculate(); + } + }); }); // 선택된 옵션 출력