Translations of this page:

A simple JS-Module, working with the timer services

timer.prototype = new app();
 
function timer(prefix, container) {
 
	// declare the functions
	this.initTimer = initTimer;
	this.actualize = actualize;
 
	// Calling the "Constructor"
	if(arguments.length > 0) this.initTimer(container);
 
	// Constructor
	function initTimer(container) {
		this.initApp(container);   // Calling the superconstructor
		this.importTemplate('modules/timer/timer.html', this.container);   // Path relative to the by HTTP-Called file, NOT relative to this file
 
		// Adding an event handler
		this.addCEvent('btn_actualize', 'click', 'actualize');
		// => On every click on the DOM-Objekt with the id "btn_actualize" call the method "actualize"
 
		// Instantiate the two services
		this.zeitApi = new api('timer_zeit');
		this.datumApi = new api('timer_datum');
		this.actualize();
	}
 
	// Call the actual time from the server and fill the results in the DOM-Objects 'zeit', 'datum' respectively
	function actualize() {
		// This actually does the AJAX and so the PHP-Method-Call
		var zeit = this.zeitApi.getTime();
		var datum = this.datumApi.getTime();
 
		// Inserting the results into the HTML
		this.getObj('zeit').innerHTML = zeit;
		this.getObj('datum').innerHTML = datum;
	}
}
 
en/dev/coreall/js.txt · Last modified: 10.12.2007 17:19 by kaegi
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki