Начало
Калькуляторы
Процент Увеличения
JavaScript поможет Вам определить процент увеличения. Это - совершенно простой пример использования функции возвращения JavaScript. Проверьте это!
Enter the two numbers to determine the percent of increase:
to
The percentage of increase is
JavaScript Calculators: процент увелечения
<!-- TWO STEPS TO INSTALL PERCENT OF INCREASE: 1. Copy the coding into the HEAD of your HTML document 2. Add the last code into the BODY of your HTML document --> <!-- STEP ONE: Paste this code into the HEAD of your HTML document --> <HEAD> <SCRIPT LANGUAGE="JavaScript"> <! > <! > <!-- Begin function findIncrease(form) { var num1 = form.num1.value; var num2 = form.num2.value; return ((num2 - num1) / num1 * 100 + "%"); } // End --> </script> </HEAD> <!-- STEP TWO: Copy this code into the BODY of your HTML document --> <BODY> <center> <form name=increaseform> Enter the two numbers to determine the percent of increase:<p> <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);"><p> The percentage of increase is <input type=text name=answer size=6> </form> </center> <!-- Script Size: 1.17 KB -->