Not sure why I all the Months shows up for each Sales in the text area instead of individually like January: 46987, February: 43768, etc. And my High and Low does not show the Months either, only numbers. Please see img. Thanks for the help.



Here are the codes:
Code JavaScript:
<html>
  <head>
  <title></title>
 
  <script type="text/javascript">
    function Main()
    {
    var Sales=new Array(12);
    var Average;
    var Low,High;
 
    Months=["January","February","March,April","May","June","July","August","September","October","November","December"];
    Sales=[46987,43768,38987,36181,35129,40245,52156,49546,51120,47345,45675,53769];
 
    //input section
 
 
 
    //calculate section
    Average=CalcAverage(Sales);
    High=CalcHigh(Sales);
    Low=CalcLow(Sales);
 
    //output section
    for (J=0;J<12;J++)
    {
    document.frmMain.taOutput.value=document.frmMain.taOutput.value+Months+" " +Sales[J]+"\n";
    }
    document.frmMain.taOutput.value=document.frmMain.taOutput.value+"\nAverage: "+Average+"\n";
    document.frmMain.taOutput.value=document.frmMain.taOutput.value+"\nHigh: "+High+"\n";
    document.frmMain.taOutput.value=document.frmMain.taOutput.value+"Low: "+Low;
    }
 
    function CalcAverage(Sales)
    {
    var Total,Average;
    var J;
 
    Total=0;
    for (J=0;J<12;J++)    
    {
    Total+=Sales[J];
    }
    Average=Total/12.;
 
    return Average;
    }
 
    function CalcHigh(Sales)
    {
    var High,J;
 
    High=Sales[0];
    for (J=0;J<12;J++)
    {
    if (Sales[J]>High)
    High=Sales[J];
    }
 
    return High;
    }
 
    function CalcLow(Sales)
    {
    var Low,J;
 
    Low=Sales[0];
    for(J=0;J<12;J++)
    {
    if (Sales[J]<Low)
    Low=Sales[J];
    }
 
    return Low;
    }
  </script>
  </head>
 
  <body bgcolor="lightgray" style="color:darkblue">
 
 
    <form name="frmMain" style="text-align:center">
    <br />
 
    January <input type="text" name="txtSales1" size=4 value=46987><br /><br />  
    February <input type="text" name="txtSales2" size=4 value=43768><br /><br />   
    March <input type="text" name="txtSales3" size=4 value=38987><br /><br /> 
    April <input type="text" name="txtSales4" size=4 value=36181><br /><br />  
    May <input type="text" name="txtSales5" size=4 value=35129><br /><br />  
    June <input type="text" name="txtSales6" size=4 value=40245><br /><br />   
    July <input type="text" name="txtSales7" size=4 value=52156><br /><br />  
    August <input type="text" name="txtSales8" size=4 value=49546><br /><br />  
    September <input type="text" name="txtSales9" size=4 value=51120><br /><br /> 
    October <input type="text" name="txtSales10" size=4 value=47345><br /><br />  
    November <input type="text" name="txtSales11" size=4 value=45675><br /><br />  
    December <input type="text" name="txtSales12" size=4 value=53769><br /><br />
 
    <br /><br /><br />
    <input type="button" value="Calculate Average" onClick="Main();"/>
    <br /><br /><br />
    <textarea name="taOutput" rows=14 cols=30 wrap="virtual"></textarea>
 
  </form>
  </body>
</html>