如何添加 jQuery UI DatePicker 按钮触发脚本
我有一个有效的 jQuery UI DatePicker 脚本,仅 显示周三和周三SAT(参见下面的主要脚本)。
我还有一个有效的 jQuery UI DatePicker 脚本,它添加了 用于触发 DatePicker 的按钮图像(请参阅下面的触发脚本)。
如何将触发脚本集成到主脚本中?
我知道这很简单,但这个新手无法弄清楚语法。 抱歉...
触发脚本:
<script>
$(function() {
$( "#datepicker" ).datepicker({
showOn: "button",
buttonImage: "css/blitzer/images/calendar.gif",
buttonImageOnly: true
});
});
</script>
主脚本:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Disable Certains Days in a Week using jQuery UI DatePicker</title>
<link rel="stylesheet" href="css/redmond/jquery-ui-1.8.6.custom.css" type="text/css" />
<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.8.6.custom.min.js"></script>
<script type="text/javascript">
$(function() {
$("#datepicker").datepicker(
{ beforeShowDay: function(day) {
var day = day.getDay();
if (day == 0 || day == 1 || day == 2 || day == 4 || day == 5) {
return [false, "somecssclass"]
} else {
return [true, "someothercssclass"]
}
}
});
});
</script>
</head>
<body>
<input id="datepicker"/>
</body>
</html>
I have a working jQuery UI DatePicker script that only
displays WED & SAT (see MAIN SCRIPT below).
I also have a working jQuery UI DatePicker script that adds
a button image to trigger the DatePicker (see TRIGGER SCRIPT BELOW).
How can I integrate the TRIGGER SCRIPT into the MAIN SCRIPT?
I know this is simple but this newbie can't figure out out the syntax.
Sorry about that....
Trigger script:
<script>
$(function() {
$( "#datepicker" ).datepicker({
showOn: "button",
buttonImage: "css/blitzer/images/calendar.gif",
buttonImageOnly: true
});
});
</script>
Main script:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Disable Certains Days in a Week using jQuery UI DatePicker</title>
<link rel="stylesheet" href="css/redmond/jquery-ui-1.8.6.custom.css" type="text/css" />
<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.8.6.custom.min.js"></script>
<script type="text/javascript">
$(function() {
$("#datepicker").datepicker(
{ beforeShowDay: function(day) {
var day = day.getDay();
if (day == 0 || day == 1 || day == 2 || day == 4 || day == 5) {
return [false, "somecssclass"]
} else {
return [true, "someothercssclass"]
}
}
});
});
</script>
</head>
<body>
<input id="datepicker"/>
</body>
</html>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
在你的主脚本中:
In your main script:
找到的解决方案:如何添加 jQuery UI DatePicker 按钮触发脚本。
Solution Found: How to Add jQuery UI DatePicker Button TRIGGER SCRIPT.