|
<%@ Page Language="C#"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Untitled Page</title>
<script src="../js/prototype.js" type="text/javascript"></script>
<style type="text/css" media="screen">
#quote {
color: green;
font-size:small;
border: 1px solid #cfc;
padding: 5px 0 5px 40px;
font-family: Verdana, Arial, Helvetica, sans-serif;
}
input.button
{
padding: 2px 5px;
border-width:1px;
color:Green;
border-style: solid;
}
</style>
</head>
<body>
<div id="quote"></div>
<p>
<input type="button" onclick="stopPolling()" value="Stop Ajax" class="button" />
<input type="button" onclick="startPolling()" value="Start Ajax" class="button" />
<script language="javascript" type="text/javascript" >
var poller;
poller = new Ajax.PeriodicalUpdater('quote', 'QuoteScript.aspx', {
method: 'get', frequency: 5
});
function stopPolling() {
poller.stop();
$(quote).innerHTML = "Asynchronous JavaScript Stopped";
}
function startPolling() {
poller.start();
}
</script>
</body>
</html>
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
I'm a professional .NET software developer and proud military veteran. I've been in the software business for 20+ years now and if there's one lesson I have learned over the years, its that in this industry you have to be prepared to be humbled from time to time and never stop learning!