--- In JavaScript_Official%40yahoogroups.com">JavaScript_Official
yahoogroups.com, "David Smart"
<smartware.consulting
...> wrote:
>
> Can I assume, then, that you actually have pictures corresponding
to each
> day of the week (Monday, Tuesday, etc) rather than the actual
date? (I.e.
> seven pictures?)
>
> If so, you can grab the day of the week from a date and use that.
(But then
> you don't actually need the date, you can simply run a loop from 1
to 7, or
> 0 to 6, and display the pictures for each day.)
>
> Or do you have 31 pictures and want to display the particular
picture
> relating to each day of the month?
>
> If so, then some of the solutions that have been posted here simply
use the
> day part of the date to make up the image name directly. Those are
the ones
> you want. (Others have specifically handled 31 separately because
that
> looked like what you wanted. You can discard that bit.)
>
> In future, please do not post code for analysis without also
posting a
> description of what it is actually supposed to do. As you can see,
simply
> reading the code leads to confusion.
>
> Regards, Dave S
>
> ----- Original Message -----
> From: "sri.vikram" < no_reply%40yahoogroups.com">no_reply
yahoogroups.com>
> To: < JavaScript_Official%40yahoogroups.com">JavaScript_Official
yahoogroups.com>
> Sent: Thursday, May 31, 2007 8:57 PM
> Subject: Re: [JavaScript] Reduce the Code please!!!!
>
>
> > --- In JavaScript_Official%40yahoogroups.com">JavaScript_Official
yahoogroups.com, "David Smart"
> > <smartware.consulting
> wrote:
> >>
> >> Why does 31 go to zero when the others go to a position in the
> > array equal
> >> to the day's date?
> >>
> >> Regards, Dave S
> >>
> >> ----- Original Message -----
> >> From: "sri.vikram" < no_reply%40yahoogroups.com">no_reply
yahoogroups.com>
> >> To: < JavaScript_Official%40yahoogroups.com">JavaScript_Official
yahoogroups.com>
> >> Sent: Thursday, May 31, 2007 4:48 AM
> >> Subject: [JavaScript] Reduce the Code please!!!!
> >>
> >>
> >> >
> >> > Is there any code reducing technique available for this?
> >> > please tell me how can i reduce this...???
> >> > B'cos i have to add still more days to get the result.
> >> > Which control statement is good for this?
> >> > ---------------------------------------
> >> > // my code....
> >> > <Script Language="JavaScript">
> >> > var photos=new Array()
> >> > photos[0]="1.jpg"
> >> > photos[1]="2.jpg"
> >> > photos[2]="3.jpg"
> >> > photos[3]="4.jpg"
> >> > photos[4]="5.jpg"
> >> >
> >> > var now=new Date()
> >> > if (now.getDate()==31) {
> >> > document.write('<img src="'+photos[0]+'" name="vikram"
> > border=0>')
> >> > }
> >> > if (now.getDate()==1) {
> >> > document.write('<img src="'+photos[1]+'" name="vikram"
> > border=0>')
> >> >
> >> > }
> >> > if (now.getDate()==2) {
> >> > document.write('<img src="'+photos[2]+'" name="vikram"
> > border=0>')
> >> >
> >> > }
> >> > if (now.getDate()==3) {
> >> > document.write('<img src="'+photos[3]+'" name="vikram"
> > border=0>')
> >> >
> >> > }
> >> > if (now.getDate()==4) {
> >> > document.write('<img src="'+photos[4]+'" name="vikram"
> > border=0>')
> >> >
> >> > }
> >> > if (now.getDate()==5) {
> >> > document.write('<img src="'+photos[5]+'" name="vikram"
> > border=0>')
> >> >
> >> > }
> >> > if (now.getDate()==6) {
> >> > document.write('<img src="'+photos[6]+'" name="vikram"
> > border=0>')
> >> >
> >> > }
> >> > </Script>
> >> >
> >> >
> >> >
> >> > Visit http://aiaiai.com for more groups to join
> >> > Yahoo! Groups Links
> >> >
> >> >
> >> >
> >> >
> > I'm just experimenting, as the yesterday is 31, just to display
which
> > photo it points to.. and checking for the accuaracy. (
> > Any how can i
> >
> >
> >
> >