테스트 사이트 - 개발 중인 베타 버전입니다

질문좀 드립니다.~~

designPARK 8년 전 조회 2,628

</p><p><script type="text/javascript">
function showpicks() {
  _s = "";
  if (document.exf1.c1.checked) _s += "단무지";
  if (document.exf1.c2.checked) _s += "홍당무";
  document.exf1.t1.value = _s;
}
</script>
<input type="checkbox" id="c1" onclick=showpicks() value="단무지">
<input type="checkbox" id="c2" onclick=showpicks() value="홍당무"></p><p> </p><p> </p><p> echo "<input type=\"text\" onfocus=blur() name=\"t1\" value=\"\" size=\"30\">\n";</p><p>

 

 

 

위에있는 체크박스로 list.10.skin.php 여기 스킨파일에 echo "<input type="checkbox" id="c1" onclick=showpicks() value="단무지">\n";

한줄로 반복문을 써서 넣고 싶은데 생각보다 잘 안되네요 ㅠㅠ

어떻게 처리해야할지... 좀 도와주실분 없으신가요... 

댓글을 작성하려면 로그인이 필요합니다.

답변 4개

d
8년 전


현재 그림과 같이 제가 위에 올려놓은 코드를 사용하여 진행되어진 상태가 그림과 같은 상태입니다.

저기서 현재 체크박스를 선택하면 첫번째 상품 하나만 나타나는데 원하는 상품 체크박스를 선택시 아래에 최소 4개까지가 나타났으면 하는데 이부분이 잘 안되네요 ㅠㅠ 

로그인 후 평가할 수 있습니다

댓글을 작성하려면 로그인이 필요합니다.

8년 전

id="price_td"<---이것이 어떤 구조로 되어있는지 모르겠지만 위소스로 볼때

동일한 id가 여러개 나올 것으로 추측이 되는데 이렇게 되어서는 작동할 수가 없습니다

id는 동일한 것이 있으면 안됩니다

 

 id=\"sellHope\" onclick='eventCheck.call(this)' class=\"inputnone\"

이것도 마찬가지로 동일한 id가 여러개 반복 되어나올 것인데

document.mofrom.sellHope.checked == false?"none":"block";

이것이 작동할 수가 없습니다

sellHope.checked <---sellHope가 여러개인데 어느 것을 말하는지 알 수가 없죠


삭제

function eventCheck() {
var price_td = document.getElementById("price_td");
price_td.style.display = document.mofrom.sellHope.checked == false?"none":"block"; 
}


삭제

id=\"sellHope\" onclick='eventCheck.call(this)'

----------------------------------------------------

id="price_td" ---> class="price_td" 로 수정(price_id가 상품 갯수 만큼 있다고 추측)

자바스크립트 부분에 추가

$(function(){

 $('.inputnone').click(function(){

    idx= $('.inputnone').index( $(this) );

    if($(this).is(":checked") $('.price_td').eq(idx).show(); 

    else $('.price_td').eq(idx).hide(); 

  });

});



로그인 후 평가할 수 있습니다

댓글을 작성하려면 로그인이 필요합니다.

d
8년 전

</p><p><script language="javascript">
$("document").ready(function(){
 var Sum,Num;      
 $("input[name=Cost]").click(function(){
  Sum = 0;
  $("input[name=Cost]").each(function(){
   if ($(this).is(":checked")==true)
   {
    Sum = Sum + parseFloat($(this).val());           
   }        
  });
  Num = parseFloat($("input[name=CostA]").val());
  $("#Sum").text(Num-Sum);
 });
 $("input[name=CostA]").keyup(function(){
  Sum = 0;
  $("input[name=Cost]").each(function(){
   if ($(this).is(":checked")==true)
   {
    Sum = Sum + parseFloat($(this).val());
   }        
  });
  Num = parseFloat($("input[name=CostA]").val());
  $("#Sum").text(Num-Sum);
 }); 
});
</script></p><p>

 

list.10.skin.php

</p><p><script language="javascript">
    function eventCheck() {
        var price_td = document.getElementById("price_td");
        price_td.style.display = document.mofrom.sellHope.checked == false?"none":"block";
    }</p><p><!--
    function eventCheck(){
    var obj = document.getElementById("ctg_1");
    obj.style.display = this.checked?'block':'none';
    }
//-->
</script></p><p>
<form name="mofrom" action="action.php" method="post" enctype="multipart/form-data" onSubmit="return eventCheck();">
<!-- 상품진열 10 시작 { -->
<?php
for ($i=1; $row=sql_fetch_array($result2); $i++) {
    if ($this->list_mod >= 2) { // 1줄 이미지 : 2개 이상
        if ($i%$this->list_mod == 0) $sct_last = 'sct_last'; // 줄 마지막
        else if ($i%$this->list_mod == 1) $sct_last = 'sct_clear'; // 줄 첫번째
        else $sct_last = '';
    } else { // 1줄 이미지 : 1개
        $sct_last = 'sct_clear';
    }</p><p>    if ($i == 1) {
        if ($this->css) {
            echo "<ul class=\"{$this->css}\">\n";
        } else {
            echo "<ul class=\"sct gct_10\">\n";
        }
    }</p><p>    //echo "<li class=\"sct_li {$sct_last}\" style=\"width:{$this->img_width}px\">\n";
 echo "<li class=\"sct_li {$sct_last}\">\n";</p><p>    if ($this->view_it_img) {
  echo "<div class=\"sct_img\">\n";
        echo get_it_image2($row['it_id'], $this->img_width, $this->img_height, '', '', stripslashes($row['it_name']))."\n";
  echo "</div>\n";
    }</p><p> if ($this->view_it_name) {
  echo "<div class=\"sct_id\"><input type=\"checkbox\" name=\"Cost\" id=\"sellHope\" onclick='eventCheck.call(this)' class=\"inputnone\" value=\"".stripslashes($row['it_price'])."\">\n";
        echo stripslashes($row['it_name'])."\n";
  echo "</div>\n";
    }</p><p>
    if ($this->view_it_basic && $row['it_basic']) {
        echo "<div class=\"sct_basic\">".stripslashes($row['it_basic'])."</div>\n";
    }</p><p> if ($this->view_it_img) {
  echo "<div style=\"position:fixed; bottom:30px; z-index:999\">\n";
  echo "<div id=\"ctg_1\" style=\"display:none;\">\n";
        echo "<div style=\"width:150px; margin:auto; border:1px solid #f1f1f1; background:#fff;\">\n";
        echo get_it_image2($row['it_id'], 100, 100, '', '', stripslashes($row['it_name']))."\n";
  echo "</div>\n";
  echo "<div style=\"width:200px; color:#fff; overflow:hidden;\">\n";
        echo stripslashes($row['it_name'])."
\n";
  echo "<span style=\"color:#f7758c; font-size:1.2em;\">\n";
  echo number_format($member['mb_point'])."\n";
  echo "</span>\n";
  echo "</div>\n";
  echo "</div>\n";
  echo "</div>\n";
    }</p><p>    echo "</li>\n";
}</p><p>if ($i > 1) echo "</ul>\n";</p><p>
 echo "<div style=\"position:fixed; bottom:0; width:1095px; margin:0 auto; height:200px; background:rgba(0,0,0,0.8); border:1px solid #ccc; border-left:none; border-right:none; z-index:99\">\n";
 echo "<div style=\"float:right; width:auto; background:#f9f9f9; text-align:right; padding:0 30px; overflow:hidden;\">\n";
 echo "<div style=\"display:none;\">현재 포인트 : <input type=\"text\" name=\"CostA\" value=\"".stripslashes($member['mb_point'])."\" style=\"text-align:right;\"></div>\n";
 echo "현재 포인트 : <label id=\"Sum\" style=\"font-size:2.6em; color:#f65672;\">".stripslashes($member['mb_point'])."</label>\n";
 echo "</div>\n";
 echo "</div>\n";</p><p>if($i == 1) echo "<p class=\"sct_noitem\">등록된 상품이 없습니다.</p>\n";
?>
<!-- } 상품진열 10 끝 -->
</form></p><p>

메인 상품리스트에서 각 상품마다 체크박스를 넣고 원하는 상품의 체크박스를 선택하면 레이어상에 그 해당 상품이 미리보기 형식처럼 출력시키려고 합니다. 예를들어 체크박스 3개를 선택하면 하단 레이어에 선택된 상품이 노출이 되게끔 하려고 하는데 현재는 제일 첫번째것만 뜨고 있습니다.

아무리 해봐도 그 이상은 선택이 안되네요 ㅠㅠ

좀 도와 주실분 없으신가요 ㅠㅠ

 

 

로그인 후 평가할 수 있습니다

댓글을 작성하려면 로그인이 필요합니다.

8년 전

무슨 말인지 이해 불가입니다

 

로그인 후 평가할 수 있습니다

댓글을 작성하려면 로그인이 필요합니다.

답변을 작성하려면 로그인이 필요합니다.

로그인