Kev*_*ler -2 javascript jquery jquery-ui syntax-error
我使用以下代码获得了一个Unxepected Identifier编辑器.我整天都在排它故障,什么都没有.希望一双新鲜的眼睛可以发现我的错误.我正在尝试使用jQuery UI来设置日期选择器,然后获取并操纵日期.更改选择器上的日期应通过ajax更改与该日期关联的页面上的图像.
$(document).ready(function(){
// Datepicker
$('#datepicker').datepicker({
dateFormat: 'yy-mm-dd',
inline: true,
minDate: new Date(2012, 06 - 1, 1),
maxDate:new Date(2012, 09 - 1, 31),
onSelect: function(){
var day1 = ($("#datepicker").datepicker('getDate').getDate()).toString().replace(/(^.$)/,"0$1");
var month1 = ($("#datepicker").datepicker('getDate').getMonth() + 1).toString().replace(/(^.$)/,"0$1");
var year1 = $("#datepicker").datepicker('getDate').getFullYear();
var fullDate = year1 + "/" + month1 + "/" + day1;
var dashDate = year1 + "-" + month1 + "-" + day1;
var str_output = "<a id=\"single_image\" href=\"http://www.lasalle.edu/150/dayinhistory/" + fullDate + ".jpg\" title=\"\"><img src=\"http://www.lasalle.edu/scripts/timthumb/timthumb.php?src=http://www.lasalle.edu/150/dayinhistory/" + fullDate + ".jpg&w=560&h=350&zc=1&a=t\">";
$('#this-day-photo-archive').html(str_output);
var data = 'day=' + dashDate;
$.ajax({
url: 'http://www.lasalle.edu/150/content/day_grab.php',
type: "GET",
data: data,
cache: false,
success: function(html) {
$('#this-day-info').html(html);
console.log (html);
$(".left").click(function() {
$('#datepicker').datepicker( "setDate" , -1d );
});
$(".right").click(function() {
$('#datepicker').datepicker( "setDate" , +1d );
});
}
});
}
});
});
Run Code Online (Sandbox Code Playgroud)
你应该更换
$('#datepicker').datepicker( "setDate" , -1d );
Run Code Online (Sandbox Code Playgroud)
同
$('#datepicker').datepicker( "setDate" , "-1d" );
Run Code Online (Sandbox Code Playgroud)
(和相同的+1d)
| 归档时间: |
|
| 查看次数: |
3493 次 |
| 最近记录: |