image/icon 打开日期选择器
An image/icon opens the date selector
我有一个 HTML
/ PHP
网站,其中有一个 图像图标 (看起来像日历),我希望用户点击并打开默认的日期选择器。
用户选择保存在 mySQL
和 echoed 其他地方的日期,比如在日历图像下。
HTML :
<input type="text" id="datepicker" style="display:none">
jQuery :
<script>
$(function() {
$( "#datepicker" ).datepicker({
showOn: "button",
buttonImage: "images/calendar.gif",
buttonImageOnly: true,
buttonText: "Select date"
});
});
</script>
您还需要以下资源:
<link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
工作fiddle.
一旦您在文本框中选择了日期,您就可以通过 PHP 脚本中的 $_POST["inputName"]
获得它的值。
我有一个 HTML
/ PHP
网站,其中有一个 图像图标 (看起来像日历),我希望用户点击并打开默认的日期选择器。
用户选择保存在 mySQL
和 echoed 其他地方的日期,比如在日历图像下。
HTML :
<input type="text" id="datepicker" style="display:none">
jQuery :
<script>
$(function() {
$( "#datepicker" ).datepicker({
showOn: "button",
buttonImage: "images/calendar.gif",
buttonImageOnly: true,
buttonText: "Select date"
});
});
</script>
您还需要以下资源:
<link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
工作fiddle.
一旦您在文本框中选择了日期,您就可以通过 PHP 脚本中的 $_POST["inputName"]
获得它的值。