Hello,

  1. Selecting date is working fine.
  2. When I select a date, I want another link to come up. For example, If I select September 2020, I want to see page1.html, If I select September 2019, I want to see page2.html.

It is not working. Please help.

        <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
        <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
        <head>
            <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.js"></script>
            <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js"></script>
            <link rel="stylesheet" type="text/css" media="screen" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/base/jquery-ui.css">

            <style>
            .ui-datepicker-calendar {
                display: none;
                }
            </style>
        </head>
        <body>

        <input type="button" id="june2013only" style="display: none;" value="CLICK" />

        <a href="javascript:GetMyColor()">Click here for my color</a>

            <script type="text/javascript">
            $(function() {
                $('.date-picker').datepicker( {
                    changeMonth: true,
                    changeYear: true,
                    showButtonPanel: true,
                    dateFormat: 'MM yy',
                    onClose: function(dateText, inst) { 
                        var month = $("#ui-datepicker-div .ui-datepicker-month :selected").val();
                        var year = $("#ui-datepicker-div .ui-datepicker-year :selected").val();
                        $(this).datepicker('setDate', new Date(year, month, 1));
                    },
                    beforeShow : function(input, inst) {
                        if ((datestr = $(this).val()).length > 0) {

          if (datestr == 'September 2020') {
           function GetMyColor()
        {
           window.location.href = "page1.html";

        }
        }


         else if (datestr == 'September 2019') {
            function GetMyColor()
        {
           window.location.href = "page2.html";

        }
        }

        else  {
           var g = 0;}

                            year = datestr.substring(datestr.length-4, datestr.length);
                            month = jQuery.inArray(datestr.substring(0, datestr.length-5), $(this).datepicker('option', 'monthNames'));
                            $(this).datepicker('option', 'defaultDate', new Date(year, month, 1));
                            $(this).datepicker('setDate', new Date(year, month, 1));
                        }
                    }
                });
            });




            </script>


            <label for="startDate">Date :</label>
            <input name="startDate" id="startDate" class="date-picker" />
        </body>
        </html> 
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.