»
EnglishFrenchVietnamese

Print - Gain in Percent Calculator - JavaScriptBank.com

Full version: jsB@nk » Calculation » Gain in Percent Calculator
URL: https://www.javascriptbank.com/gain-in-percent-calculator.html

Gain in Percent Calculator © JavaScriptBank.comCalculate the percentage of increase/decrease between two units. A simple, effective script.

Full version: jsB@nk » Calculation » Gain in Percent Calculator
URL: https://www.javascriptbank.com/gain-in-percent-calculator.html



CSS
<style>INPUT.gain2 {BORDER-RIGHT: blue thin; BORDER-TOP: blue thin; FONT-WEIGHT: bold; BORDER-LEFT: blue thin; COLOR: white; BORDER-BOTTOM: blue thin; BACKGROUND-COLOR: blue}</style><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


JavaScript
<script language="javascript">// Created by: Sandeep Gangadharan :: http://www.sivamdesign.com/scripts/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) + "%";}</script><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


HTML
<form name="form1"><table align="center">  <tr>    <td>      Increase/Decrease From: <input type="text" size="5" name="first">      To: <input type="text" size="6" name="second">    <br>      Percent of Gain: <input type="text" readonly="readonly" size="6" name="answer">    <br>      <input type="button" class="gain2" value="Calculate Gain" onclick="getPercent()">         <input type="reset" class="gain2" value="Clear All Fields">    </td>  </tr></table></form><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->