日期:2014-05-16  浏览次数:20659 次

jquery datepicker onchange問題
Java code
function gettime(str) {

                var strURL="/Doctor/booking/gettime.jsp?datepicker="+str;
                var req = getXMLHTTP();

                if (req) {

                    req.onreadystatechange = function() {
                        if (req.readyState == 4) {
                            // only if "OK"
                            if (req.status == 200) {
                                document.getElementById('datepicker').innerHTML=req.responseText;
                            } else {
                                alert("There was a problem while using XMLHTTP:\n" + req.statusText);
                            }
                        }
                    }
                    req.open("GET", strURL, true);
                    req.send(null);
                }
            }


Java code
<b>Date: <input type="text" id="datepicker" name="datepicker" readonly="true" onchange="gettime(this.value)"></b>
$(document).ready(function() {
        $(function() {
            $( "#datepicker" ).datepicker({dateFormat: 'yy-mm-dd',
                maxDate: '+1m',
                minDate: 'Now',
                beforeShowDay: noSundays
            });
        });
    });
    function noSundays(a) {   a=a.getDay();   return[a>0&&a<7,""]; }




為什麼onchange沒效???

------解决方案--------------------
探讨

如果不是用jquery datepicker,用普通input onchange都可以用到