calculate percentage with java : I have a form where I want the user to input a few fields and the form will calculate the total and percentage of goal. I'm new to java, and I don't know how to calculate a percentage. When I try parseint(total)/parseint(goal)*100 I get a NaN error.

    
        <html>
          <head>

            <style media="screen">
              .testform INPUT{display: block;margin-bottom:10px;border:1px solid #212121;height:35px;font-size: 16px;}
            </style>

            <script type="text/javascript">
            calculate = function()
            {

                var cash = document.getElementById('a1').value;
                var checks = document.getElementById('a2').value;
                var coin = document.getElementById('a3').value;
                var goal = document.getElementById('goalamount').value;
                var total = document.getElementById('a4').value;
                document.getElementById('a4').value = parseInt(cash)+parseInt(checks)+parseInt(coin);
                document.getElementById('a5').value = parseInt(total)+parseInt(goal);
              }

            </script>
          </head>
          <body>

        <form class="testform">
          Goal amount <input id="goalamount" type="text" value="3000"/>
          Cash Collected <input id="a1" type="text" />
          Checks Collected <input id="a2" type="text" />
          Coins Collected <input id="a3" type="text"  />
          Total Collected <input id="a4" type="text" name="total_amt" onblur="calculate()" />
          Percent of Goal<input id="a5" type="text" name="goal_amt" />
        </form>





          </body>
        </html>