I'm building a simple webpage for wedding event. Let's say that I need to show a countdown and I want to get the date to start it from an input form. I've been googling a lot and I've seen some interesting code but it's late and my eyes and mind are very tired. This is my code...
<?php $date = date('207/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="http://ift.tt/2a1Bldc"></script>
<script src="http://ift.tt/2mfOJyA"></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>
Aucun commentaire:
Enregistrer un commentaire