john pfeiffer
  • Home
  • Categories
  • Tags
  • Archives

javascript chart

<html>
<body>
<script type="text/javascript">

var total = 8000000;
var current = 781720 + 620161 + 372628;
var percent = current / total;


function Comma(number)
{

    number = '' + number;
    if (number.length > 3)
    {
        var mod = number.length % 3;
        var output = (mod > 0 ? (number.substring(0,mod)) : '');

        for (i=0 ; i < Math.floor(number.length / 3); i++)
        {
            if ((mod == 0) && (i == 0))
            {   output += number.substring(mod+ 3 * i, mod + 3 * i + 3);    }
            else
            {       output+= ',' + number.substring(mod + 3 * i, mod + 3 * i + 3);  }
        }
        return (output);
    }
    else{    return number;     }
}

document.write('<table border="0"><tr><td align="center">');

document.write( "GOAL: Pounds" + Comma( total ) );
document.write('<table border="0">');
for( i=1; i<50; i++)
{
    document.write("<tr>");



  if( i > ( ( (1 - percent) * 100) /2))
    {
        document.write('<td bgcolor="#ff0000">');
        document.write('');
    }
    else{
        document.write('<td bgcolor="#00ffff">');
        document.write("<td>");
    }

    document.write("</td></tr>");
}
document.write("</table>");

document.write("Sales Week 12 = Pounds" + Comma(current));

document.write("<br />");

document.write('</td></tr></table>');

</script>
</body>
</html>

  • « javascript chart two column
  • php function get ip address »

Published

May 29, 2016

Category

javascript

~110 words

Tags

  • chart 4
  • javascript 43