Script Categories













Calculators >>> Percent Of Increase.

Enter two numbers and JavaScript will help you determine the percent of increase. This is a perfectly simple example of using a JavaScript return function.

Enter the two numbers to determine the percent of increase:

to

The percentage of increase is

Add the below code to the <body> section of your page:

<script language="javascript" type="text/javascript">
/* Visit http://www.yaldex.com/ for full source code
and get more free JavaScript, CSS and DHTML scripts! */
<!-- Begin
function findIncrease(form) {
var num1 = form.num1.value;
var num2 = form.num2.value;
return ((num2 - num1) / num1 * 100 + "%");
}
//  End -->
</script>
<form name=increaseform>
<b>Enter the two numbers to determine the percent of increase:</b><br><br>
<input type=text name=num1 size=4> to <input type=text name=num2 size=4>
<input type=button value="Solve" onClick="this.form.answer.value = findIncrease(this.form);"><br><br>
<
b>The percentage of increase is </b><input type=text name=answer size=6>
</form>

JavaScript Editor Get Advanced
JavaScript and Ajax Editor,
Validator and Debugger!

1st JavaScript Editor.



Code was highlighted by 1st JavaScript Editor (The Best JavaScript Editor!).

R7


©