2014-04-17 1 views
0

SetCookie()와 GetCookie() 모두 잘 작동합니다.JS Cookie에서 조건 만들기

문제 :

메이크업 상태 IF 쿠키 값은하지 NULL은 BOX 쇼 그렇지 않으면 숨기기를 계속합니다.

나는 벨로우즈 코드를 실행했지만 조건은 만족스럽지 않습니다. 내가 우는 소리 code.its을 사용하여 삭제 쿠키

$(document).ready(function(){ 
     var first_name = getCookie("chat_name"); 
     var user_id = getCookie("chat_id"); 
     var img_src = getCookie("chat_img"); 

     if(first_name !=="" && user_id !=="" && img_src !=="") 
      // if(document.cookie.length > 0) 
     { 
      $("#chat_output").show(); 
      $("#hidebox").show(); 
      $("#chat_store").show(); 
      $("#chat_box").show(); 
     } 

}); 

좋은

document.cookie ="chat_id=''"; 
    document.cookie ="chat_name=''"; 
    document.cookie ="chat_img=''"; 

당신은 내가이 문제를 해결할 수있는 방법을 나에게 제안 할 수 있습니다 작동합니다.

은 당신이 찾고있는 무엇을해야 당신

답변

0

if (getCookie("cookie-name")===null){ /* code to show box */ }

감사드립니다.

+0

작동하지 않음 – Ravi