Login   Register  
Icontem

File: jspoll_test.html

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Kulcsár Zoltán  >  JsPoll  >  jspoll_test.html  >  Download  
File: jspoll_test.html
Role: Example script
Content type: text/plain
Description: Test and demo page
Class: JsPoll
Manage timer events and invoke callbacks functions
Author: By
Last change:
Date: 2010-11-07 03:45
Size: 1,295 bytes
 

Contents

Class file image Download
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=windows-1250">
<title>JsPoll test page</title>
<script language='javascript' src='./jspoll.class.js'></script>
</head>
<body>
<div id="poll_log" style="width:300px; height:400px; overflow:auto;">
</div>
<script language='javascript'>
var pollObject = new JsPoll(1000);

pollObject.subscribe(JsPoll.Events.START, function() {
	document.getElementById("poll_log").innerHTML += "Polling started<br/>";
	return true;
});

pollObject.subscribe(JsPoll.Events.STOP, function() {
	document.getElementById("poll_log").innerHTML += "Polling stopped<br/>";
	return true;
});

pollObject.subscribe(JsPoll.Events.TICK, function() {
	document.getElementById("poll_log").innerHTML += "tick event - fn 1<br/>";
	return true;
});

pollObject.subscribe(JsPoll.Events.TICK, function() {
	document.getElementById("poll_log").innerHTML += "tick event - fn 2<br/>";
	return true;
});

pollObject.startPolling();

</script>
<button onclick="pollObject.startPolling()">Start polling</button>
<button onclick="pollObject.stopPolling()">Stop polling</button>
<button onclick="pollObject.killPolling()">Kill polling</button>

</body>
</html>