尝试让Phongegap的Calendar插件正常工作。我要做的是在点击event
时注册活动。还使用Jquery Mobile。
代码:
<title>Calendar</title>
<script type="text/javascript" src="cordova-2.5.0.js"></script>
<script type="text/javascript" src="js/index.js"></script>
<script type="text/javascript" src="ja/calendar.js"></script>
<script type="text/javascript">
var cal;
cal = window.plugins.calendarPlugin;
$('#event').click(function() {
function createEvent(title,location,notes, startDate, endDate){
var title = document.getElementById=("eventTitle");
var notes = document.getElementById=("eventNotes");
var startDate = document.getElementById=("eventStart");
var endDate = document.getElementById=("eventEnd");
cal.createEvent(title,location,notes,startDate,endDate);
}
});
</script>
</head>
<body>
<body>
Titel:<input type="text" id="eventTitle"><br>
Anteckning:<input type="text" id="eventNotes"><br>
Startdatum:<input type="date" id="eventStart"><br>
Slutdatum:<input type="date" id="eventEnd"><br>
<button id="event">Create event</button>
</body>
</html>
答案 0 :(得分:0)
尝试使用jQuery来定义变量,我刚刚完成了像你这样的项目,我的代码看起来像这样:
var title = $("#name").val();
var location = $("#location").val()
var notes = $("#notes").val();
// getting dates using the moment.js file
var s = $("#startDate").val();
var startDate = moment(s).toDate();
var e = $("#endDate").val();
var endDate = moment(e).toDate();
它的日期方面正在使用别的东西来获取时间和日期。但是你看到这里的基本格式。试试看,让我知道它是怎么回事