包括jquery插件倒计时后不起作用

时间:2013-07-10 05:52:50

标签: javascript jquery

我在sharepoint中有一个内容编辑器webpart,代码如下,但倒计时不起作用。 我注意到这个网站使用的是旧版本的jquery 1.6.3,我想知道这可能是原因。

<script src="/Style%20Library/countdown/jquery.countdown.js" type="text/javascript">

<link rel="stylesheet" type="text/css" href="/Style%20Library/countdown/jquery.countdown.css" />

<script class="ms-rteForeColor-3" type="text/javascript">
    $(function () {
        var austDay = new Date(2013, 7 - 1, 27);
        $('#countdown').countdown({until: austDay});
    });
</script>

<div id="countdownBox">
    <h3 class="ms-rteElement-H3 ms-rteForeColor-3">Countdown to go-live</h3>
    <span class="countdown" id="countdown"></span>
</div>

更新1

firefox控制台出错。错误在控制台上泛滥太多次

时间戳:10/07/2013 08:13:21 警告:解析'filter'的值时出错。宣言下降。 源文件:https://xx/Communities/xx/Pages/project-xx.aspx 行:0 源代码: α(不透明度= 99.00000000000007)

这是生成的html,我想知道css是否必须在头部?

<DIV id=WebPartWPQ7 class="ms-WPBody noindex" allowDelete="false" width="100%" HasPers="false" WebPartID="c1b5cf92-534f-4d23-8cd0-8c0fbe8f541b">
<SCRIPT type=text/javascript src="/Style%20Library/countdown/jquery.countdown.js">
<link rel="stylesheet" type="text/css" href="/Style%20Library/countdown/jquery.countdown.css" />
<script type="text/javascript">
$(document).ready(function() {
    var austDay = new Date(2013, 7 - 1, 27);
    $('#countdown').countdown({until: austDay});
    });</SCRIPT>

<DIV id=countdownBox>
<H3 class="ms-rteElement-H3 ms-rteForeColor-3">Countdown to go-live</H3><SPAN id=countdown class=countdown></SPAN></DIV></DIV>

1 个答案:

答案 0 :(得分:1)

jsFiddle正常工作:http://jsfiddle.net/Fnsgk/3

但是你应该添加一个结束脚本标签:

<script src="/Style%20Library/countdown/jquery.countdown.js" type="text/javascript">
</script>