我得到與本網站的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代碼爲 datetimepicker
<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顯示「$ .datetimepicker是未定義」
此錯誤被扔在這一行「document.getElementById("TotalLabel").value = $.datetimepicker.parseDate('yy-mm-dd', '2012-05-23');
」
我想通過我在datetimepicker中選擇的值傳遞給我的codebehind c#方法。 我的問題在哪裏?
我導入了所有需要的js文件,在我看來,我得到了正確的順序,我是如何導入它們的。
格爾茨
託比
有你這包括日期時間選擇器 – AlphaMale
+1上述評論的js文件,而且,你指定 'YY-MM-DD',但提供「YYYY -mm-dd' – ahren