5 Replies Latest reply on Sep 27, 2011 6:22 AM by csm_phil

    Date & Day & Month please help

    csm_phil Level 4

      Hi Scripters,

       

      I have creat a diary book in InDesign CS4.

       

      Probelm: I want to alert the date and day for each time like this. But after the 7 saturday after alert the 8th day is undefined result.

       

      Date     Day

      1          Sunday

      2          Monday

      3          Tuesday

      4          Wednesday

      5          Thursday

      6          Friday

      7          Saturday          This is alert fine after the date execute in 8 i want to alert Day "Sunday" but i get it result in "undefined"

       

      Please check my Below JS Code Give your valuable output.

       

       

      var myMonth= new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
      var myDay = new Array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday");
      var myThirty = new Array("1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30");
      var myThirtyfirst = new Array("1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31");
      var myFeb = new Array("1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28");
      
      for(i=0; i<myMonth.length; i++){
          if(myMonth[i]=="January"){
              for(j=0; j<=myThirtyfirst.length; j++){
                  alert(myThirtyfirst[j]+"|"+myDay[j]);
                     // after the 8 day is alert is shown  in undefined; i want to continue after the next month is started in wednesday or some other day please check 
                  }
              }
          else if(myMonth[i]=="February"){
              for(j=0; j<=myFeb.length; j++){
                  alert(myFeb[j]+"|"+myDay[j]);
                  }
              }
          else if(myMonth[i]=="March"){
              for(j=0; j<=myThirtyfirst.length; j++){
                  alert(myThirtyfirst[j]+"|"+myDay[j]);
                  }
              }
          }
      

       

      Note: Saturday & Sunday will come in one alert. Definitely i am confused little bit think so.

       

      thx

      csm_phil