【发布时间】:2015-12-30 15:04:42
【问题描述】:
我正在使用 The Final Countdown v2.0.4 ,它在我的本地机器上工作得很好,但在我的网络主机上,它似乎没有按预期工作。它没有倒计时,而是立即转到 00:00。
jQuery 代码:
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery.countdown.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$(".timeLeft").each(function(i, obj) {
var $dis = $(this), finalDate = $(this).text().replace("-", "/").replace("-", "/");
var u = 0;
$dis.countdown(finalDate, function(event) {
$dis.text(event.strftime('%M:%S'));
if(event.offset.minutes < 25 && u == 0) {
$dis.next().next().find("input[type='image']").attr("src", "images/glyphicons/png/glyphicons-207-ok.png");
u++;
$dis.next().next().find("input[type='image']").attr("title", "Acceptera uppdraget");
}
});
});
});
</script>
具体的HTML代码:
<thead class="mission_title">
<tr>
<td class="timeLeft"><?php echo /*$interval->format("%I:%S")*/ $missions[$i]["expire"]; ?></td>
<td><form method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]) . "?do=request&id=" . $missions[$i]["id"]; ?>"><input type="number" title="Föreslå ersättning" style="width:35px;" min="<?php echo $missions[$i]["payment"]; ?>" value="<?php echo $missions[$i]["payment"]; ?>" name="price_offer"> <input name="request" type="image" src="<?php echo ($_SESSION["plus"] == 1 ? "images/glyphicons/png/glyphicons-207-ok.png" : "images/glyphicons/png/glyphicons-208-remove.png"); ?>" alt="Acceptera Uppdraget" title="<?php echo ($_SESSION["plus"] == 1 ? "Acceptera uppdraget." : "Du måste vänta fem minuter innan du kan acceptera uppdraget." );?>" value="send"></td>
</tr>
</thead>
感谢任何帮助,我尝试搜索并且许多人建议区分大小写可能是一个问题;我无法在控制台或校对代码中找到任何内容,所以我不知道问题出在哪里。 :(
编辑:
jQuery 导入工作正常,我一直在使用其他 jQuery 函数,例如 .click(),并且没有问题。
【问题讨论】:
-
这似乎很明显,但是 jquery.countdown.min.js 在服务器上的正确位置吗?
-
是的!该函数运行但它没有倒计时它立即进入 00:00
标签: javascript jquery localhost