2014-03-03 72 views
0

我有一個問題,當我想包括一個datepicker部件。 我想這樣做:enter link description here。 我下載ZIP,但這裏:enter link description here如何包括Jquery小部件datepicker

這裏我的html代碼:

<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> 
<title></title> 
<script src="js/jquery-1.10.2.js"></script> 
<script src="js/jquery-ui-1.10.4.custom"></script> 
<script src="js/jquery-ui-1.10.4.custom.min"></script> 
<script> 
    $(function() { 
     $("#from").datepicker({ 
      defaultDate: "+1w", 
      changeMonth: true, 
      numberOfMonths: 3, 
      onClose: function (selectedDate) { 
       $("#to").datepicker("option", "minDate", selectedDate); 
      } 
     }); 
     $("#to").datepicker({ 
      defaultDate: "+1w", 
      changeMonth: true, 
      numberOfMonths: 3, 
      onClose: function (selectedDate) { 
       $("#from").datepicker("option", "maxDate", selectedDate); 
      } 
     }); 
    }); 
</script> 
</head> 
<body> 
<div><label for="from">From</label> 
<input type="text" id="from" name="from"/> 
<label for="to">to</label> 
<input type="text" id="to" name="to"/> 
    </div> 
<br /> 
<table id="table_campaigns" class="display"> 
    <caption style="font-size:20px">Statistiek 6</caption> 
<thead> 
</thead> 
<tbody> 
</tbody> 
</table> 
<br /> 
<br /> 

<table id="table1" class="display"> 
<thead> 
</thead> 
<tbody> 
</tbody> 
</table> 
</body> 
</html> 

我有這樣的:語法錯誤:語法錯誤

難道我下載ZIP權?怎麼了?

回答

2
<script src="js/jquery-ui-1.10.4.custom"></script> 
<script src="js/jquery-ui-1.10.4.custom.min"></script> 

不要同時使用,只是其中之一...

,你也有錯誤的文件名,你缺少.js

+0

謝謝。 Datepicker運行良好,但我的數據表TypeError出錯:$(...)。dataTable不是函數 「bAutoWidth」:false。爲什麼? – Jayce

1

http://api.jqueryui.com/1.8/datepicker/

Additional Notes: 

This widget requires some functional CSS, otherwise it won't work. 
If you build a custom theme, use the widget's specific CSS file as a starting point. 

你應該包括jquery-ui.css

+0

也謝謝,但我的數據表TypeError出錯:$(...)。dataTable不是函數「bAutoWidth」:false。爲什麼? – Jayce

+1

我沒有看到任何'',你是否加載它(與它的.css)? – Kalzem

+0

我有一個html頁面,它是索引,它包括js和css文件。 – Jayce

相關問題