File: simple_example.html

Recommend this page to a friend!
  Classes of Arturs Sosins   Countdown   simple_example.html   Download  
File: simple_example.html
Role: Example script
Content type: text/plain
Description: Simple example
Class: Countdown
Display a countdown to a given time
Author: By
Last change:
Date: 12 years ago
Size: 1,828 bytes
 

Contents

Class file image Download
<!-- /************************************************************* * This script is developed by Arturs Sosins aka ar2rsawseen, http://webcodingeasy.com * Feel free to distribute and modify code, but keep reference to its creator * * Coutndown class displays updating countdown using provided left time. * It is possible to display countdown in different timw unites and formats * using format string, which also accepts HTML tags * * For more information, examples and online documentation visit: * http://webcodingeasy.com/JS-classes/Updating-multi-format-javascript-countdown **************************************************************/ --> <html> <head> <style type='text/css'> #countdown { color: blue; font-size: 18px; } </style> </head> <body> <div id='seconds'></div> <div id='countdown'></div> <script src="./countdown.packed.js" type="text/javascript"></script> <script> var cd = new countdown("countdown", { year: 0, //years left month: 1, //months left week: 0, //weeks left day: 0, //days left hour: 0, //hours left min: 0, //minutes left sec: 5, //seconds left //format how countdown will look format: "[{y} years] [{m} months] [{w} weeks] [{d} days] {h}:{i}:{s}", end: "Countdown Ended", //text that will appear after end of countdown hide_zeros : true, // hide highest units that reached 0 leading_zeros: true, //show leading zeros for hours minutes and seconds timezone: 3, //recalculate relative to timezone (default - visitors default timezone) //callback function which is called every second and tells how meny seconds are left onstep: function(sec){document.getElementById("seconds").innerHTML = sec;}, onend: function(){alert("ended")} //callback function when countdown ended } ); </script> </body> </html>