With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Amount Incrementer</title>
<script type="text/javascript">
function calcAmount() {
var dateNow = new Date();
var dateStart = new Date();
var incAmount = .01; // change to the amount by which you wish to increment
dateStart.setDate(1);
dateStart.setMonth(0);
dateStart.setHours(0);
dateStart.setMinutes(0);
dateStart.setSeconds(0);
dateStart.setMilliseconds(0);
t = setTimeout(calcAmount, 1);
document.getElementById('amount').innerHTML = "$" + CurrencyFormatted(incAmount*parseInt((dateNow - dateStart)/(1000)));
}
// function for formatting numbers in currency format
function CurrencyFormatted(amount)
{
var i = parseFloat(amount);
if (isNaN(i)) {
i = 0.00;
}
var minus = '';
if (i < 0) {
minus = '-';
}
i = Math.abs(i);
i = parseInt((i + .005) * 100);
i = i / 100;
s = new String(i);
if (s.indexOf('.') < 0) {
s += '.00';
}
if (s.indexOf('.') == (s.length - 2)) {
s += '0';
}
s = minus + s;
s = CommaFormatted(s)
return s;
}
// function for formatting numbers with embedded commas
function CommaFormatted(amount)
{
var delimiter = ","; // replace comma if desired
var a = amount.split('.',2)
var d = a[1];
var i = parseInt(a[0]);
if (isNaN(i)) {
return '';
}
var minus = '';
if (i < 0) {
minus = '-';
}
i = Math.abs(i);
var n = new String(i);
var a = [];
while(n.length > 3)
{
var nn = n.substr(n.length-3);
a.unshift(nn);
n = n.substr(0,n.length-3);
}
if (n.length > 0) {
a.unshift(n);
}
n = a.join(delimiter);
if (d.length < 1) {
amount = n;
} else {
amount = n + '.' + d;
}
amount = minus + amount;
return amount;
}
</script>
</head>
<body onload="calcAmount();">
Current amount is: <span id="amount"></span>
</body>
</html>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Amount Incrementer</title>
<style type="text/css">
#amount { font-face:courier; font-weight:bold; color:teal; }
</style>
<script type="text/javascript">
// function for formatting numbers in currency format
function CurrencyFormatted(amount)
{
var i = parseFloat(amount);
if (isNaN(i)) {
i = 0.00;
}
var minus = '';
if (i < 0) {
minus = '-';
}
i = Math.abs(i);
i = parseInt((i + .005) * 100);
i = i / 100;
s = new String(i);
if (s.indexOf('.') < 0) {
s += '.00';
}
if (s.indexOf('.') == (s.length - 2)) {
s += '0';
}
s = minus + s;
s = CommaFormatted(s)
return s;
}
// function for formatting numbers with embedded commas
function CommaFormatted(amount)
{
var delimiter = ","; // replace comma if desired
var a = amount.split('.',2)
var d = a[1];
var i = parseInt(a[0]);
if (isNaN(i)) {
return '';
}
var minus = '';
if (i < 0) {
minus = '-';
}
i = Math.abs(i);
var n = new String(i);
var a = [];
while(n.length > 3)
{
var nn = n.substr(n.length-3);
a.unshift(nn);
n = n.substr(0,n.length-3);
}
if (n.length > 0) {
a.unshift(n);
}
n = a.join(delimiter);
if (d.length < 1) {
amount = n;
} else {
amount = n + '.' + d;
}
amount = minus + amount;
return amount;
}
var amount = 1030301.01; // load from server
window.onload=function() {
var delay = 100; // milliseconds
var incAmount = .01; // change to the amount by which you wish to increment
var tId = setInterval(function() {
document.getElementById('amount').innerHTML = "$" + CurrencyFormatted(amount+=incAmount);
},delay)
}
</script>
</head>
<body>
Current amount is: <span id="amount"></span>
</body>
</html>
If you are experiencing a similar issue, please ask a related question
Join the community of 500,000 technology professionals and ask your questions.