Php-javascript Date selector combo

From: Date: Wed, 29 Nov 2000 14:54:36 +0000
Subject: Php-javascript Date selector combo
Groups: php.general 
Request: Send a blank email to php-general+get-27819@lists.php.net to get a copy of this message
What's the error in the following code?? If I select a date and then change the month, none error happens unless i select the last day of the month and change to a month with less days.... Regards... > > ------------------------------------------------ > > <head> > > <script language="javascript1.2"> > > months=new Array() > > <?php > > $i=1; > > while ($i<=12) > > { > > $months[$i]=date("M",mktime(0,0,0,$i,1,0)); > > ?> > > months[<?echo $i;?>]="<?echo $months[$i];?>"; > > <? > > $i++; > > } > > ?> > > function mes_onChange() > > { > > aa = document.dateForm.aa; > > mm = document.dateForm.mm; > > dd = document.dateForm.dd; > > AA = aa.selectedIndex+1999; > > MM = mm.selectedIndex+1; > > DD = dd.selectedIndex; > > if( ( MM == 4 || MM == 6 || MM == 9 || MM ==11)) > > { > > dias = 30; > > } > > if( (MM == 1 || MM == 3 || MM == 5 || MM == 7 || MM == 8 || MM == 10 || > > MM > > == 12)) > > { > > dias = 31; > > } > > if( MM == 2 ) > > { > > if( AA % 4 == 0 && AA % 100 != 0 || AA % 400 == 0 ) > > dias = 29; > > else > > dias = 28; > > } > > dd.length=0; > > for (i=1; i<=dias; i++) > > { > > o=new Option(i); > > dd.options[dd.length]=o; > > } > > dd.options[DD].selected=true; > > } > > </script> > > </head> > > <form name=dateForm> > > Dia3 > > <select name=dd> > > <? for ($i=1; $i<=date("t"); $i++) > > { > > if ($i==date("d")) > > { > > echo "<option selected>$i"; > > } else { > > echo "<option>$i"; > > } > > } > > ?> > > </select> > > Month3 > > <select name=mm onchange=mes_onChange()> > > <? for ($i=1; $i<=12; $i++) > > { > > if ($i==date("m")) > > { > > echo "<option selected>$months[$i]"; > > } else { > > echo "<option>$months[$i]"; > > } > > } > > ?> > > </select> > > Year3 > > <select name=aa onchange=mes_onChange()> > > <? for ($i=1999; $i<=date("Y")+1; $i++) > > { > > if ($i==date("Y")) > > { > > echo "<option selected>$i"; > > } else { > > echo "<option>$i"; > > } > > } > > ?> > > </select> > > </form> > > ------------------------------------------------------ > > --------------------------------------------------------------------- > > Lista de soporte de LinuxPPP > > Reglas de la lista en http://pepe.net.mx/reglas.html > > > > --------------------------------------------------------------------- > > Lista de soporte de LinuxPPP > > Reglas de la lista en http://pepe.net.mx/reglas.html > --------------------------------------------------------------------- > Lista de soporte de LinuxPPP > Reglas de la lista en http://pepe.net.mx/reglas.html

« previous php.general (#27819) next »