<!-- Paste this code into an external JavaScript file named: gainCalc.js  -->
 

function getPercent() {

  theAnswer = ((document.form1.second.value - document.form1.first.value) / document.form1.first.value * 100);

  num1 = Math.pow(10, 2);

  document.form1.answer.value = (Math.round(theAnswer * num1) / num1) + "%";

}


