Loading ...
Sorry, an error occurred while loading the content.

Re: [JavaScript] Reduce the Code please!!!!

Expand Messages
  • Rafael C.P.
    var now=(new Date()).getDate(); if (now == 31) now = 0; document.write( ); ... -- =========
    Message 1 of 9 , May 31, 2007
    • 0 Attachment
      <script>
      var now=(new Date()).getDate();
      if (now == 31) now = 0;
      document.write('<img src="'+now+'.jpg" name="vikram" border="0">');
      </script>

      On 5/30/07, sri. vikram <no_reply@yahoogroups.com> wrote:
      >
      >
      > 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>
      >
      >
      >



      --
      =========
      Rafael C.P.
      =========


      [Non-text portions of this message have been removed]
    • Rafael C.P.
      Correction: The idea seems ok, but if think the method is getDay(), not getDate(). ... -- ========= Rafael C.P. ========= [Non-text portions of this message
      Message 2 of 9 , May 31, 2007
      • 0 Attachment
        Correction: The idea seems ok, but if think the method is getDay(), not
        getDate().

        On 5/31/07, Rafael C.P. <kurama.youko.br@...> wrote:
        >
        > <script>
        > var now=(new Date()).getDate();
        > if (now == 31) now = 0;
        > document.write('<img src="'+now+'.jpg" name="vikram" border="0">');
        > </script>
        >
        > On 5/30/07, sri. vikram <no_reply@yahoogroups.com> wrote:
        > >
        > >
        > > 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>
        > >
        > >
        > >
        >
        >
        >
        > --
        > =========
        > Rafael C.P.
        > =========




        --
        =========
        Rafael C.P.
        =========


        [Non-text portions of this message have been removed]
      • sri.vikram
        Thank you very much for Stevie s simple code . its great but simple. Bye ... border=0 );
        Message 3 of 9 , Jun 2, 2007
        • 0 Attachment
          Thank you very much for Stevie's simple code . its great but simple.
          Bye

          --- In JavaScript_Official@yahoogroups.com, Esteban Glas
          <stevie_glas@...> wrote:
          >
          > var now=new Date();
          > var todaysPhoto = now.getDate() + '.jpg';
          > document.write('<img src="'+todaysPhoto+'" name="vikram"
          border=0>');
          >
          > Will that work?
          >
          > sri.vikram wrote:
          > >
          > >
          > > 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>
          > >
          > >
          >
        Your message has been successfully submitted and would be delivered to recipients shortly.