So I'm trying to make an incrementer similar to this: http://www.usagain.com/ but I'm apparently missing code to get it to work. What am I missing from getting this to count? Here's my very similar code:
<html>
<head>
<title>Recycle Counter</title>
<script language="javascript" src="../jquery1.6.js"></script>
<script type="text/javascript">
/*function rand(from, to)
{
return Math.floor(Math.random() * (to - from + 1) + from); // Generates random number
} rand(10000, 100000);*/
function addCommas(nStr) //http://www.mredkj.com/javascript/nfbasic.html -- Source
{
nStr += '';
x = nStr.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() {
function updateNum(){
$('#counter').load('test.php');
}
setTimeout(updateNum, 1000);
}
</script>
<style type="text/css">
#counterContainer{color: blue;font-family:Comic Sans MS;font-size:20px;}
#counter{display:inline;}
</style>
</head>
<body onload="getNum()">
<div id="counterContainer">
Counter ::: <div id="counter"> </div>
</div>
</body>
</html>
PHP
<?php
for(int $i = 0; $i < 100; $i++)
echo $i;
?>
I imagine I need to write to a file at some point but I tried that earlier and had troubles. This time though it won't even show the count. Suggestion on what I can do?