SitePoint Sponsor

User Tag List

Results 1 to 1 of 1
  1. #1
    SitePoint Member
    Join Date
    May 2011
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    hmm check out this script...

    hi guys i need a bit of help understanding this script as i m a complete noob in coding

    Code JavaScript:
    <script language="JavaScript">
     
    var clickCount = readCookie();
    if ( clickCount == null ){
        clickCount = 0;
    }
     
    function trackclick() {
        clickCount = parseInt(clickCount)+1;
        setCookie( clickCount, 2 );
        return true;
    }
     
    function setCookie( cookieValue, nDays) {
        var today = new Date();
        var expire = new Date();
        if (nDays==null || nDays==0) nDays=1;
        expire.setTime(today.getTime() + 3600000*24*nDays);
        document.cookie = "clicktrack="+escape(cookieValue)
                          + ";expires="+expire.toGMTString();
    }
     
    function readCookie() {
        var nameEQ = "clicktrack=";
        var ca = document.cookie.split(';');
        for(var i=0;i < ca.length;i++) {
            var c = ca[i];
            while (c.charAt(0)==' ') c = c.substring(1,c.length);
            if (c.indexOf(nameEQ) == 0){
                return c.substring(nameEQ.length,c.length);
            }
        }
        return null;
    }
     
    </script>

    please explain me aboutndays plz plz
    Last edited by Mittineague; Jun 11, 2011 at 19:22. Reason: reformatting bbcode tags


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •