<!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>
|