<div id="dnn_ctr5587_Display_UP">
<script type="text/javascript">
var interval = .1;
var counter, count = 0, updatedate;
$(document).ready(function () {
$.ajax({
type: "GET",
url: "/DesktopModules/Ticker/TickerXml.aspx",
dataType: "xml",
success: function (xml) {
$(xml).find("Ticker").each(function () {
var $ticker = $(this);
counter = $ticker.find('counter').text();
updatedate = $ticker.find('updateddate').text();
});
}
});
if(typeof(counter) == "undefined") {
counter = 5568487;
updatedate = '10/20/2010 12:00:00 AM';
}
/*counter = 5408328;
updatedate = '9/23/2010 1:38:40 PM';*/
setTimeout(function () { getcounter(); }, 250);
setInterval("getcounter();", interval * 60 * 1000);
});
function addCommas(number)
{
number += '';
x = number.split('.');
x1 = x[0];
x2 = x.length > 1 ? '.' + x[1] : '';
var rgx = /(\d+)(\d{3})/;
while (rgx.test(x1))
{
x1 = x1.replace(rgx, '$1' + ',' + '$2');
}
return x1 + x2;
}
function getcounter()
{
var currenttime = new Date();
updatedate = new Date(Date.parse(updatedate));
var seconds = calculate(updatedate, currenttime);
var addedupdates = Math.floor(seconds / (60*interval));
if (count == 0)
{
count = counter;
count = parseInt(count) + parseInt(addedupdates);
}
counter = addCommas(count);
var counterarray = counter.split(",");
var html = '';
for(var i=0; i<counterarray.length; i++)
{
html += '<span>'+counterarray[i]+'</span>';
}
$(".downloadCounter").html('Over <strong>'+html+'</strong> Downloads');
count++;
}
function calculate(update, current) {
current = new Date(current);
update = new Date(update);
var sec = current.getTime() - update.getTime();
if (isNaN(sec)) {
// input data is incorrect!");
$(".downloadCounter").html('Over <strong>5</strong> <strong>500</strong> <strong>000</strong> Downloads');
}
var second = 1000, minute = 60 * second, hour = 60 * minute, day = 24 * hour;
var days = Math.floor(sec / day);
sec -= days * day;
var hours = Math.floor(sec / hour);
sec -= hours * hour;
var minutes = Math.floor(sec / minute);
sec -= minutes * minute;
var seconds = Math.floor(sec / second);
var totalsecond = seconds + (minutes * 60) + (60 * 60 * hours) + (60 * 60 * hours * days);
return totalsecond;
}
</script>
<div class="downloadCounter"><strong><span>5</span><span>444</span>000</strong></div>
</div><div id="dnn_ctr5587_Display_UP_Prog" style="display:none;">
<img src="/images/progressbar.gif" alt="ProgressBar" style="border-width:0px;" />
</div>
</div>
where /DesktopModules/Ticker/TickerXml.aspx returns something like this:
<?xml version="1.0" encoding="utf-8" ?>
<Root>
<Ticker>
<counter>5583710</counter>
<updateddate>10/30/2010 2:33:09 AM</updateddate>
</Ticker>
</Root>
so, you would have to have your own serverside process that returns the data, then you can use jquery in combination with a timer to update counts every second or so.