Javascript 如何将所选日期从弹出窗口显示到所选id

Javascript 如何将所选日期从弹出窗口显示到所选id,javascript,jquery,Javascript,Jquery,在我的项目中,我有一个类似日期的要求,应该显示上一个和下一个链接,在下一个链接旁边有一个弹出的jquery日历来选择特定的日期。这一点我已经实现如下 <script> function ShowSchedule() { document.getElementById("today").innerHTML = date; } function ShowDay(isNextDay) { if (isNextDay) {

在我的项目中,我有一个类似日期的要求,应该显示上一个和下一个链接,在下一个链接旁边有一个弹出的jquery日历来选择特定的日期。这一点我已经实现如下

<script>
    function ShowSchedule() {
        document.getElementById("today").innerHTML = date;
    }

    function ShowDay(isNextDay) {
        if (isNextDay) {
            currentTime = new Date(currentTime.getFullYear(), month, currentTime.getDate() + 1);
            date = month_name[currentTime.getMonth()] + " " + currentTime.getDate() + ", " + currentTime.getFullYear();
            ShowSchedule();
        }
        else {
            currentTime = new Date(currentTime.getFullYear(), month, currentTime.getDate() - 1);
            date = month_name[currentTime.getMonth()] + " " + currentTime.getDate() + ", " + currentTime.getFullYear();
            ShowSchedule();
        }
    }

    $(function() {
        $('#tday').datepick({
            changeMonth: false,
            dateFormat: 'M dd, yyyy',
            showTrigger: '#calImg'
        });
    });
</script>

<body>
    <form>
        <div>
            <a id="prev" href="#" onClick="ShowDay(false)">Prev</a>
            <span id="today">
            </span>
            <a id="next" href="#" onClick="ShowDay(true)">Next</a>
            <input id="tday" />
        </div>
        <script>
            ShowSchedule();
        </script>
    </form>
</body>
通过使用上述代码,我能够显示当前系统日期,以及日历弹出窗口中的上一个和下一个链接。但问题是在从弹出日历中选择日期后,我需要显示所选日期当前日期位置。i、 例如,今天的日期是2012年5月25日,如果用户选择的日期是2012年5月20日,则所选日期应显示在2012年5月25日以及上一个和下一个链接的位置


任何帮助都将不胜感激

为什么我看不到任何编辑按钮?我想格式化代码,但没有“编辑”按钮!这到底是怎么回事?@ParthThakkar您需要2000名代表来编辑其他人的问题/答案尽管代码在任何方面都不好全局变量和重复,但这里有什么问题?好像有用…你能把它弄出来吗?