'메뉴이동'에 해당되는 글 1건

  1. 2010.04.14 [Javascript] 메뉴 좌우이동 수정버전

function selectClick(){
 var form = document.basicInfoForm;
 var idx = form.shopNo.length;
 var opt = form.shopNo.options;
 for(var i=0; i<form.unselect.length; i++){
  if(form.unselect.options[i].selected==true){
   if(idx>0){
    for(var j=0; j<idx; j++){
     if(form.unselect.options[i].text==form.shopNo.options[j].text){
      alert('이미 선택한 shop입니다.');
      return ;
     }
    }
    alert('선택한 shop에 매장이 추가됩니다.');
    form.shopNo.length += 1;
    opt[idx] = new Option(form.unselect.options[i].text, form.unselect.options[i].value, false, false);
    form.unselect.selectedIndex =-1;
    return ;
   }else{
    alert('선택한 shop에 매장이 추가됩니다.');
    form.shopNo.length += 1;
    opt[idx] = new Option(form.unselect.options[i].text, form.unselect.options[i].value, false, false);
    form.unselect.selectedIndex =-1;
   }
  }
 }
}

function unSelectClick(){
 var form = document.basicInfoForm;
 var idx = form.unselect.length;
 var idx2 = form.shopNo.length;
 alert(idx2);
 
 if(idx2==null||idx2==''){
  alert('선택한 shop이 없습니다.');
  return ;
 }
 
 for(var i=0; i<idx2; i++){
  if(basicInfoForm.shopNo.options[i].selected==true){
   var shopNo = basicInfoForm.shopNo.options[i].value;
   var result = confirm('선택한 shop에서 본 매장이 삭제됩니다. 삭제하시겠습니까?');
   if(result==true){
    $.ajax({
     url: '/display/collection/deleteShopAjax.do',
     method: 'post',
     data: 'no='+'${basicInfo.collectionNo }'+'&shopNo='+shopNo,
     success: function(html){
      alert('매장과 shop의 연결이 삭제되었습니다.');      
      },
     error: function(){
      alert('Ajax popup open fail.');
      }
    });
    basicInfoForm.shopNo.options[i] = null;
    idx2 -= 1;
    i -= 1;
   }else{
    return ;
   }
  }
 }
}

Posted by zeide
,