我从这个站点遇到了 datetimepicker 的问题:
http://trentrichardson.com/examples/timepicker/
这是js代码:
var dates = $("#ArrivalStartDatepicker").datetimepicker({
defaultDate: "+lw",
dateFormat: 'dd-mm-yy',
changeMonth: true,
numberOfMonths: 2,
ampm: true,
stepMinute: 10,
minuteGrid: 10,
onSelect: function (selectedDate) {
// var option = this.id == "ArrivalStartDatepicker" ? "minDate" : "maxDate",
// instance = $(this).data("datetimepicker"),
document.getElementById("TotalLabel").value = $.datetimepicker.parseDate('yy-mm-dd', '2012-05-23');
// instance.settings.dateFormat ||
// $.datetimepicker._defaults.dateFormat,
// selectedDate, instance.settings);
// dates.not(this).datetimepicker("option", option, date);
// document.getElementById("TotalLabel").value = date;
}
});
这是我的日期时间选择器的 html 代码
<div class="txtTravel" id="DatetimePickerContainer1">
<input id="ArrivalStartDatetimepicker" type="text" name="datetimepicker" placeholder="dd-mm-yyyy hh:mm am"/>
</div>
这是这个 .aspx 网站的负责人
<%@ Page Title="GH" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="GH.aspx.cs" Inherits="GBCalc.GH" MaintainScrollPositionOnPostback="True"%>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
<link rel="stylesheet" type="text/css" href="Styles/timepicker.css" />
<link href="Styles/base/jquery.ui.base.css" rel="stylesheet" type="text/css" />
<link href="Styles/base/jquery.ui.all.css" rel="stylesheet" type="text/css" />
<link href="Styles/base/jquery.ui.theme.css" rel="stylesheet" type="text/css" />
<style type="text/css">
div.txtGeneral{position: relative; left: 110px; top: 55px; margin-top: 1.5px;}
div.lblGeneral{position:relative; left: -6px; top: 75px; margin: 1.5px; font-size: small;}
div.txtJob{position: absolute; top: 92px; left: 520px; }
div.lblJob{position: absolute; top: 92px; left: 370px; font-size: small;}
div.txtTravel{position: relative; left: 200px; top: 70px;}
div.lblTravel{position: relative; left: 0px; top: 90px; margin: 1.5px; font-size: small;}
div.txtWork{position: relative; left: 250px; top: 0px;}
div.lblWork{position: relative; left: 20px; top: 20px; margin: 1.5px; font-size: small;}
div.lblMisc{position: relative; left: -5px; top: -1px; margin: 1.5px; font-size: small;}
div.txtMisc{position: relative; left: 170px; top: -20px;}
</style>
<script src="Scripts/ui/jquery-1.7.2.min.js" type="text/javascript"></script>
<script src="Scripts/ui/jquery-ui-1.8.20.custom.min.js" type="text/javascript"></script>
<script src="Scripts/ui/jquery-ui-timepicker-addon.js" type="text/javascript"></script>
<script src="Scripts/ui/molschaua.js" type="text/javascript"></script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<asp:DropDownList ID="SubsidiaryCalcDropDownList" runat="server"
ToolTip="Subsidiary maker of the Calculation">
</asp:DropDownList>
<br />
<br />
<div id="MyAccordion">
问题是如果我打开网站会显示日期时间选择器,但是一旦我选择日期或时间,萤火虫就会抛出一个名为“$.datetimepicker 未定义”的错误
document.getElementById("TotalLabel").value = $.datetimepicker.parseDate('yy-mm-dd', '2012-05-23');
此错误在此行“ ”中引发
我想将我在 datetimepicker 中选择的值传递给我的代码隐藏 c# 方法。我的问题在哪里?
我导入了所有需要的 js 文件,在我看来,我得到了正确的导入顺序。
问候
托比