Script Categories













Calendars >>> Select Day.

Shows a pull down menu from which you can select any day from the current month.

Add the below code to the <body> section of your page:

<FORM>
<SELECT
NAME="dates" SIZE=1>
<script language="javascript" type="text/javascript">
/* Visit http://www.yaldex.com/ for full source code
and get more free JavaScript, CSS and DHTML scripts! */

        today = new Date();
        thismonth = today.getMonth() + 1;
        thisyear = today.getYear();
        thisday = today.getDate();

        maxdays=31;//default

        // months with 30 days
        if (thismonth==4 || thismonth==6 || thismonth==9 || thismonth==11)
        {
                maxdays=30
        }

        // february, leap year
        if (thismonth==2)
        {
                // feb
                if ((thisyear/4)!=parseInt(thisyear/4))
                {
                        maxdays=28
                }
                else
                {
                        //leap year
                        maxdays=29
                }
        }

        thismonth = "" + thismonth
       
if (thismonth.length == 1)
        {
                thismonth = "0" + thismonth;
        }

        for (var theday = 0; theday <= maxdays; theday++)
        {
                if (theday == 0)
                {
                        document.write ("<OPTION SELECTED> "+ thismonth + "-" + thisday + "-" + thisyear )
                        document.write ("<OPTION> ========")
                }
                else
                {
                        var thed = "" + theday
                       
if (thed.length == 1)
                        {
                                thed = "0" + thed;
                        }
                        document.write ("<OPTION> " + thismonth + "-" + thed + "-" + thisyear)
                }
        }
</script>
</SELECT>
</FORM>

JavaScript Editor Get Advanced
JavaScript and Ajax Editor,
Validator and Debugger!

1st JavaScript Editor.



Code was highlighted by 1st JavaScript Editor (The Best JavaScript Editor!).




©