수량 증가/감소
2015.08.12 16:48
430
1
https://eond.com/360638
object(HotopayModel)#862 (23) { ["error"]=> int(0) ["message"]=> string(7) "success" ["variables"]=> array(0) { } ["httpStatusCode"]=> int(200) ["module"]=> string(7) "hotopay" ["module_info"]=> NULL ["origin_module_info"]=> NULL ["module_config"]=> NULL ["module_path"]=> string(52) "/home/eond/web/eond.com/public_html/modules/hotopay/" ["xml_info"]=> NULL ["module_srl"]=> NULL ["mid"]=> NULL ["act"]=> NULL ["template_path"]=> NULL ["template_file"]=> NULL ["layout_path"]=> NULL ["layout_file"]=> NULL ["edited_layout_file"]=> NULL ["stop_proc"]=> bool(false) ["user"]=> object(Rhymix\Framework\Helpers\SessionHelper)#861 (20) { ["member_srl"]=> int(0) ["user_id"]=> NULL ["user_name"]=> NULL ["nick_name"]=> NULL ["email_address"]=> NULL ["phone_number"]=> NULL ["homepage"]=> NULL ["blog"]=> NULL ["birthday"]=> NULL ["denied"]=> NULL ["status"]=> NULL ["is_admin"]=> string(1) "N" ["is_site_admin"]=> NULL ["profile_image"]=> NULL ["image_name"]=> NULL ["image_mark"]=> NULL ["signature"]=> NULL ["description"]=> NULL ["group_list"]=> array(0) { } ["menu_list"]=> array(0) { } } ["request"]=> object(Rhymix\Framework\Request)#10 (13) { ["method"]=> string(3) "GET" ["compat_method"]=> string(3) "GET" ["url"]=> string(32) "javascript/360638/comment/441279" ["hostname"]=> string(8) "eond.com" ["domain"]=> NULL ["protocol"]=> string(5) "https" ["callback_function"]=> string(0) "" ["_route_status":protected]=> int(200) ["_route_options":protected]=> object(stdClass)#11 (5) { ["cache_control"]=> bool(true) ["check_csrf"]=> bool(true) ["is_forwarded"]=> bool(false) ["is_indexable"]=> bool(true) ["enable_session"]=> bool(true) } ["module"]=> string(5) "board" ["mid"]=> string(10) "javascript" ["act"]=> string(16) "dispBoardContent" ["args"]=> array(5) { ["page"]=> int(4) ["document_srl"]=> string(6) "360638" ["comment_srl"]=> string(6) "441279" ["mid"]=> string(10) "javascript" ["act"]=> string(16) "dispBoardContent" } } ["ajaxRequestMethod"]=> array(2) { [0]=> string(6) "XMLRPC" [1]=> string(4) "JSON" } ["gzhandler_enable"]=> bool(true) }

count 라는 input이 여러개가 되면 정확한 대상을 선택 못하기 때문에 그렇습니다.
input에 id 값이나 다른 방법으로 확인을 하시면 됩니다.

아래 처럼 id 값을 가지고 구분하시던가 아니면 node로 위치를 지정해서 할 수도 있습니다.
jQuery를 사용하시면 좀더 쉽게 할 수도 있고요. 방법은 많이 있습니다. 알맞은 방식을 찾아 보시는 것이...

<script type='text/javascript'>
function fncAdd(num)
{
    var obj = document.getElementById("count_"+ele);
    var val = Number(obj.value + 1);
    if(val < 1) val=1;
    obj.value = val;
}
</script>

<form name='frm'>
수량 <input type='text' id='count_1' value='1' size='3' readonly>
<img src='/files/attach/images/350186/638/360/1d21b6d882e5b07377f9c0f476a567f3.gif' onclick='fncAdd(-1,"1");'>
<img src='/files/attach/images/350186/638/360/ae339a375766389228d5bae2c4201ed2.gif' onclick='fncAdd(1,"1");'>

수량 <input type='text' id='count_2' value='1' size='3' readonly>
<img src='/files/attach/images/350186/638/360/1d21b6d882e5b07377f9c0f476a567f3.gif' onclick='fncAdd(-1,"2");'>
<img src='/files/attach/images/350186/638/360/ae339a375766389228d5bae2c4201ed2.gif' onclick='fncAdd(1,"2");'>
</form>

출처 : http://taeyo.net/Forum/Content.aspx?SEQ=22652&TBL=JScript&PGN=1

라이믹스는 이온디와 함께

닫기

마이페이지

로그인을 해주세요

네이버로 로그인