Login   Register  
Icontem

File: example.html

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Arturs Sosins  >  Countdown  >  example.html  >  Download  
File: example.html
Role: Example script
Content type: text/plain
Description: Example with format string manipulations
Class: Countdown
Display a countdown to a given time
Author: By
Last change:
Date: 2011-07-11 07:59
Size: 2,676 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'>
div
{
	margin: 10 0;
}
</style>
</head>
<body>
<div id='cd1'></div>
<div id='cd2'></div>
<div id='cd3'></div>
<div id='cd4'></div>
<div id='cd5'></div>
<script src="./countdown.packed.js" type="text/javascript"></script>
<script>
var cd = new countdown("cd1", {
		year: 1, //years left
		month: 2, //months left
		week: 3, //weeks left
		day: 4, //days left
		hour: 5, //hours left
		min: 6, //minutes left
		sec: 7, //seconds left
		//format how countdown will look
		format: "Standart: [{y} years] [{m} months] [{w} weeks] [{d} days] [{h}:][{i}:]{s}"
	}
);
var cd = new countdown("cd2", {
		year: 1, //years left
		month: 2, //months left
		week: 3, //weeks left
		day: 4, //days left
		hour: 5, //hours left
		min: 6, //minutes left
		sec: 7, //seconds left
		//format how countdown will look
		format: "Without years - Waiting left: [{m} months] [{w} weeks] [{d} days] [{h} hours] [{i} minutes] [{s} seconds]"
	}
);
var cd = new countdown("cd3", {
		year: 1, //years left
		month: 2, //months left
		week: 3, //weeks left
		day: 4, //days left
		hour: 5, //hours left
		min: 6, //minutes left
		sec: 7, //seconds left
		//format how countdown will look
		format: "Waiting [{h} hours] [{i} minutes] [{s} seconds] for countdown to end"
	}
);
var cd = new countdown("cd4", {
		year: 1, //years left
		month: 2, //months left
		week: 3, //weeks left
		day: 4, //days left
		hour: 5, //hours left
		min: 6, //minutes left
		sec: 7, //seconds left
		//format how countdown will look
		format: "Using some HTML: <ul><li>[{h} hours]</li><li>[{i} minutes]</li><li>[{s} seconds]</li></ul>"
	}
);
var cd = new countdown("cd5", {
		year: 1, //years left
		month: 2, //months left
		week: 3, //weeks left
		day: 4, //days left
		hour: 5, //hours left
		min: 6, //minutes left
		sec: 7, //seconds left
		//format how countdown will look
		format: "Only seconds: {s}"
	}
);
</script>
</body>
</html>