사이트 내 전체검색
[javascript] 쿠키 불러오는 함수
로빈아빠
https://cmd.kr/javascript/549 URL이 복사되었습니다.

본문


  function getCookie( name ) { 

   var nameOfCookie = name + "=";

   var x = 0;
   while ( x <= document.cookie.length ) {

    var y = ( x + nameOfCookie.length );

    if ( document.cookie.substring( x, y ) == nameOfCookie ) {
     if ( ( endOfCookie=document.cookie.indexOf( ";", y ) ) == -1 ) {
      endOfCookie = document.cookie.length;
     }
     return unescape( document.cookie.substring( y, endOfCookie ) );
    }

    x = document.cookie.indexOf( " ", x ) + 1;

    if ( x == 0 ) break; 
   }

  

댓글목록

등록된 댓글이 없습니다.

831 (8/17P)

Search

Copyright © Cmd 명령어 18.118.93.123