2025-02-15

直接看代碼:

代碼中引用的所有js文件已打包(見附件1)。jquery-1.6.2.js除外。因為這個跟datepicker沒直接關系。
如果想顯示中文,直接加上附件2,就行瞭。

Java代碼 
<title>jQuery UI Datepicker – Default functionality</title> 
 
    <link rel="stylesheet" href="../jquery-ui/css/jquery.ui.all.css"> 
    <script src="../jquery-ui/jquery-1.6.2.js"></script> 
    <script src="../jquery-ui/jquery.ui.core.js"></script> 
    <script src="../jquery-ui/jquery.ui.widget.js"></script> 
    <script src="../jquery-ui/jquery.ui.datepicker.js"></script> 
<!–  顯示中文  –> 
<script src="../jquery-ui/jquery.ui.datepicker-zh-CN.js"></script> 
     
    <script> 
     
    $(function() { 
        $("#datepicker" ).datepicker(); 
    }); 
    $(document).ready(function(){ 
        //alert("fs"); 
        //$("#datepicker" ).datepicker(); 
        $("#button").click(function(){ 
            alert($("#datepicker").val());                       
        }); 
         
    }); 
    </script> 
     
</head> 
 
<body> 
<p class="demo"> 
 
 
<input type="text" id="datepicker" /> 
<input type="button" id="button" value="show" />  
</p><!– End demo –> 

 


一些參數設置:
Java代碼 
$("#datepicker").datepicker({ 
    minDate: new Date() 
}); 

作者“鄭星陽”
 

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *