关于实施的完整日历问题

时间:2014-01-26 18:43:31

标签: jquery html

我遇到了实施FullCalendar的问题...... 而且我想,我在http://arshaw.com/fullcalendar/docs/usage/的“基本用法”主题上做了所有的事情。 为什么那段代码不会出现在我的.html上的callendar?

<!DOCTYPE html SYSTEM "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>
        Callendar Test
    </title>
    <link rel='stylesheet' type='text/css' href='fullcalendar.css' />

    <script type="text/javascript" src="jquery.js"></script>

    <script type="text/javascript" src='fullcalendar.js'></script>
    <script type="text/javascript">
        $(document).ready(function() {

            // page is now ready, initialize the calendar...

            $('#calendar').fullCalendar({
                // put your options and callbacks here


            })

        });  
    </script>
</head>
<body>
    <div id='calendar'></div>


</body>
</html>

任何解决方案?

P.S。:我下载了Jquery文件(版本1.x)并与我的HTML页面放在同一个文件中。

错误:

Unknown property 'zoom'.  Declaration dropped. fullcalendar.css:107
18:50:38.058 Expected 'none' or URL but found 'alpha('.  Error in parsing value for              'filter'.  Declaration dropped. fullcalendar.css:133
18:50:38.058 Error in parsing value for 'background-image'.  Declaration dropped. fullcalendar.css:213
18:50:38.058 Error in parsing value for 'background-image'.  Declaration dropped. fullcalendar.css:214
18:50:38.058 Error in parsing value for 'background-image'.  Declaration dropped. fullcalendar.css:215
18:50:38.058 Expected 'none' or URL but found 'alpha('.  Error in parsing value for 'filter'.  Declaration dropped. fullcalendar.css:255
18:50:38.058 Expected 'none' or URL but found 'alpha('.  Error in parsing value for 'filter'.  Declaration dropped. fullcalendar.css:414
18:50:38.059 Expected declaration but found '*'.  Skipped to next declaration. fullcalendar.css:532
18:50:38.059 Expected 'none' or URL but found 'alpha('.  Error in parsing value for 'filter'.  Declaration dropped. fullcalendar.css:575
18:50:38.059 Error in parsing value for 'display'.  Declaration dropped. fullcalendar.css:580
18:50:38.092 ReferenceError: moment is not defined fullcalendar.js:12
18:50:38.094 The character encoding of the HTML document was not declared. The document will render with garbled text in some browser configurations if the document contains characters from outside the US-ASCII range. The character encoding of the page must be declared in the document or in the transfer protocol. FullCalendar.html
18:50:38.116 TypeError: $(...).fullCalendar is not a function

这是我的目录:

enter image description here

5 个答案:

答案 0 :(得分:25)

以防其他人通过Google找到此帖子并遇到同样的问题: 如果您使用FullCalendar的托管库,则必须包含moment.js(托管库上不可用,因此您必须下载它) 之前 包含fullcalendar.js文件。例如:

<script type="text/javascript" src="scripts/moment.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/fullcalendar/2.0.1/fullcalendar.min.js"></script>

FullCalendar显然有一些Moment对象的引用,甚至在它被实例化之前。

希望能帮助别人。

答案 1 :(得分:6)

您必须检查js的顺序。

moment.min.js
fullcalendar.js
lang-all.js

答案 2 :(得分:2)

18:50:38.092 ReferenceError:moment未定义fullcalendar.js:12

18:50:38.116 TypeError: $(...)。fullCalendar 不是函数。

calendar.js中,您似乎没有一个event handler可以使用jQuery定位specific id的函数。

编辑:

不确定你做错了什么,但我确保一切正常,就像你设置好一样。

如您所见,这是我的所有代码:

<!DOCTYPE html>
<html>
<head>
<link href='fullcalendar.css' rel='stylesheet' />
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src='fullcalendar.min.js'></script>
<script>

    $(document).ready(function() {

        $('#calendar').fullCalendar({
        });

    });

</script>
</head>
<body>
<div id='calendar'></div>
</body>
</html>

这是我的整个目录:

enter image description here

以下是正常工作的文件的完整存储库。

http://www.sinsysonline.com/calendar/test/full_package.zip

答案 3 :(得分:1)

确保首先包含MomentJS,因为fullcalendar.js需要这个。

这是我的错误,我收到同样的错误。

<script src="/includes/js/fullcalendar-2.0.1/lib/moment.min.js"></script>
<script src="/includes/js/fullcalendar-2.0.1/fullcalendar.min.js"></script>

答案 4 :(得分:0)

我认为js文件不在您尝试访问它的位置。

请将源元素的href属性更新到JS文件所在的源位置!

要获得解决方案,请打开控制台并查找错误。这将是404!这意味着找不到文件。

对于Chrome,请按CTRL + SHIFT + J