-1
我正在爲婚禮活動建立一個簡單的網頁。假設我需要顯示倒數計時,並且想要從輸入表單開始計算日期。我一直在使用谷歌搜索,我已經看到了一些有趣的代碼,但已經很晚了,我的眼睛和頭腦都非常疲憊。這是我的代碼...如何從datepicker表單輸入開始jquery倒計時?
<?php $date = date('2017/05/21'); // this value supossed to be taken from a form.?>
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<div id="clock"></div>
</body>
</html>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
<script src="http://www.testingserver.dev/template/assets/web/assets/jquery/jquery.countdown.min.js"></script>
<script>
var eventdate = new Date("<?php echo $date; ?>"); // I'm trying to use a php variable in jquery.
$('#clock').countdown('eventdate', function(event) {
var $this = $(this).html(event.strftime(''
//+ '<div style="background-color: #ffcc00; width: 25%;"><p>Weeks<br>%w</p></div> '
+ '<span>%D</span> days '
+ '<span>%H</span> hrs '
+ '<span>%M</span> min '
+ '<span>%S</span> sec'));
});
</script>
207/05/21''複製/粘貼錯誤?或者你真的有'207'作爲你的年值? – Sean
另外,我不認爲在jQuery UI中有'倒計時',那麼這個函數的來源是什麼?是否有一個原因,'eventdate''在引號中,作爲一個字符串,而不是沒有作爲K的var? – Sean
是一個複製/粘貼錯誤,樣本日期是2017/05/21,但它被推遲以獲得此值dinamically。 Thaks注意到了,@Sean – KAZZABE