0

我对科尔多瓦很陌生,所以请多多包涵。我正在使用此处找到的插件:https ://github.com/phonegap/phonegap-plugins/tree/master/iOS/CalendarPlugin

并在示例中实现了它,但它对我不起作用。我得到错误:

Uncaught SyntaxError: Unexpected token ( 

但看不到这是从哪里来的。

谁能指出我正确的方向?

  $(function() {

            $('.calinfo').live('click', function() {
                               var desiredValue = $(this).data('calinfo');

                               var cal;
                               cal = window.plugins.calendarPlugin

                               // function call in Javascript:

                               //createEvent : 
                               function(title,location,notes, startDate, endDate){
                               var title= "My Appt";
                               var location = "Los Felix";
                               var notes = "me testing";
                               var startDate = "2012-11-23 09:30:00";
                               var endDate = "2012-11-23 12:30:00";

                               cal.createEvent(title,location,notes,startDate,endDate);
                               };
            });
        });
4

1 回答 1

0

我对您的代码进行了一些清理,请尝试是否可行:

/*global $:true */
$(function() {
  "use strict";

  $('.calinfo').live('click', function() {
    var desiredValue = $(this).data('calinfo');
    var cal = window.plugins.calendarPlugin;

    // function call in Javascript:

    //createEvent : 
    (function createEvent(title, location, notes, startDate, endDate) {
      title= "My Appt";
      location = "Los Felix";
      notes = "me testing";
      startDate = "2012-11-23 09:30:00";
      endDate = "2012-11-23 12:30:00";

      cal.createEvent(title,location,notes,startDate,endDate);
    }());
  });
});
于 2012-08-08T09:46:14.737 回答