메뉴 건너뛰기

?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄 첨부
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄 첨부
<!doctype html>
<html lang="en">
 <head>
  <meta charset="UTF-8">
  <title>수량 증가/감소 (JQuery로 작성.)</title>
  <script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
  <script type="text/javascript">
    
    /**
    * 수량 증가/감소 (JQuery로 작성.)
    */

    function modifyProductQuantity(id, quantity){
        
         if(isNaN($("#"+id).val())){
              alert'숫자만 입력가능 합니다.' );
              $("#"+id).focus();
              $("#"+id).val(0);
              return;
         }
        
         //var v = parseFloat($("#"+id).val())+parseFloat(quantity);    
         //$("#"+id).val(Math.round(v*10)/10);
          
         var q = parseInt($("#"+id).val())+parseInt(quantity);    
         $("#"+id).val(q);


    };



 </script>
 </head>
 <body>
    수량 : 
    <input name="quantity" id="quantity" style="vertical-align:middle; text-align:right" size="5" maxlength="4" value="0" />
    <img style="vertical-align:middle;" alt="수량 증가 감소" src="btn_cnt.gif" usemap="#map_name_quantity"/>
    <map id="map_name_quantity" name="map_name_quantity">
        <area href="javascript:modifyProductQuantity('quantity',1);" shape="rect" alt="수량 증가" coords="0,0,9,10"/>
        <area href="javascript:modifyProductQuantity('quantity',-1);" shape="rect" alt="수량 감소" coords="0,10,9,20"/>
    </map>

 </body>
</html>

 



List of Articles
번호 제목 날짜 조회 수
147 자바스크립트로 네트워크 연결 확인하기 (Navigator onLine Property) file 2015.06.19 6197
146 정규식을 이용한 실시간 콤마(comma) 넣기 2015.06.19 7876
145 정규식을 이용한 콤마(comma) 제거하기 2015.06.19 6804
» 텍스트박스(input type = "text") 숫자 증가, 감소 시키기 - 쇼핑몰 주문 수량 file 2015.06.19 12281
143 Checkbox : 체크박스 체크여부 확인 file 2015.06.19 19010
142 마우스 드래그, 오른쪽 팝업메뉴, 선택 막기 (IE11, 파이어폭스, 크롬 확인) 2015.06.19 8566
141 예제 - 자바스크립트로 현재 달의 달력 만들기 (calendar) 2015.06.19 10061
140 핸드폰 번호 일부 마스킹크 작업 (정규식 이용) 2015.06.19 10741
139 창에 대한 정보얻기 (창 크기, 창 위치) file 2015.06.19 7297
138 Location 객체 - URL 파싱 - URL에서 전달인자 추출하기 함수 작성 file 2015.06.19 8523
137 예제 - 이미지를 원본 크기로 볼 수 있도록 새창으로 열기 확장 (리사이징 및 이미지 드래그) file 2015.06.19 6796
136 창 크기 최대화 시키기 file 2015.06.19 12217
135 JSON API - JSON.parse(), JSON.stringify() ( json 형태의 문자열을 JSON객체로 , JSON객체를 문자열로 ) file 2015.06.19 6289
134 자바스크립트 API 문서 2015.06.19 9086
133 공백 검사 함수 2015.06.19 14575
132 자바스크립트 아이디 기억하기 기능 구현 (쿠키저장) file 2015.06.19 10923
131 [라디오버튼 오류 체크] 간단한 문제 예제 file 2015.06.19 7712
130 iframe사용시 높이 자동 조절 2015.06.19 6958
129 이벤트 - 페이지 로드 후 이벤트 처리하기 ( window.onload ) file 2015.06.19 10871
128 jquery offset()을 이용한 부드러운 스크롤 이동 2016.09.01 7277
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 ... 13 Next
/ 13

하단 정보를 입력할 수 있습니다

© k2s0o1d4e0s2i1g5n. All Rights Reserved