Web Analytics Made Easy -
StatCounter How can I modify this "if" code ?? - CodingForum

Announcement

Collapse
No announcement yet.

How can I modify this "if" code ??

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How can I modify this "if" code ??

    I know very little about Javacript.

    As far as I can tell ---- this code reads data from a cookie and populates a picksheet.

    function rePickIt(){
    //alert(document.cookie)
    thePicks = new Array();
    if(allPicks=(document.cookie+';').match(/allPicks=(.+)\;/)){
    allPicks=unescape(allPicks[1]).split(',')
    for(i=0;i<allPicks.length;i++)
    if(pick=allPicks[i].match(/pick(\d+)=(\d+)/)){
    thePicks[pick[1]]=pick[2];
    //alert(pick[1]+': '+pick[2])
    }
    for(p=0;p<thePicks.length;p++)
    if(thePicks[p]){
    PickIt(p, thePicks[p])
    //alert(p+'>>'+ thePicks[p])
    }
    }
    }


    What I want to do is add a piece of code that would stop the populating after the 32nd pick.
    It can have a total of 63 picks.

    If there are less in the cookie ( it could have any number between 1 and 63) that is not a problem.

    I have attached the "ccokie" file that it reads.

    Please help.
    Attached Files

  • #2
    Try changing this line.

    From:
    for(i=0;i<allPicks.length;i++)

    To:
    for(i=0;i<=32;i++)

    .....Willy

    Comment


    • #3
      Thanks Willy !!!!

      It works great. I really appreciate your help.

      Comment

      Working...
      X