|
↑
Calculators >>>
Calculates the total cost of an order based on the number of items you want to order. As the total number increases, the cost per item decreases.
Single unit license |
$19.95 |
License for 2 to 4 units |
$17.50 |
License for 5 to 9 units |
$16.00 |
License for 10 to 24 units |
$13.00 |
License for 25 to 49 units |
$10.00 |
License for 50 to 99 units |
$8.00 |
License for 100 to 199 units |
$6.00 |
License for 200 or more units |
$4.00 |
Add the below code to the <body> section of your page:
<script
language="javascript"
type="text/javascript">
var
max_units =
200;
var
currency =
"$";
function
getDiscountPrice(units)
{
if
(units
>=
max_units)
return
4;
if
(units
>=
100)
return
6;
if
(units
>=
50)
return
8;
if
(units
>=
25)
return
10;
if
(units
>=
10)
return
13;
if
(units
>=
5)
return
16;
if
(units
>=
2)
return
17.50;
if
(units
==
1)
return
19.95;
if
(units
<=
0)
return
0;
}
function
getNumberOfUnits()
{
var
units
=
document.calculator.units.value;
return
(units
==
"")
?
0
:
units;
}
function
showResult(result)
{
document.calculator.respons.value
=
result;
}
function
formatMessage(units,
unit_price)
{
return
units
+
" * "
+
currency +
formatPrice(unit_price)
+
" = "
+
currency +
formatPrice(units
*
unit_price);
}
function
getAltUnits(units)
{
var
discount_price =
getDiscountPrice(units);
if
(units
<
max_units)
do
{
units++
}
while
(discount_price
==
getDiscountPrice(units));
return
units;
}
function
findPrice()
{
var
units
=
getNumberOfUnits();
var
unit_price =
getDiscountPrice(units);
var
alt_units =
getAltUnits(units);
var
alt_unit_price =
getDiscountPrice(alt_units);
var
result;
if
((units
*
unit_price)
<
(alt_units
*
alt_unit_price))
result =
formatMessage(units,
unit_price);
else
result
=
formatMessage(alt_units,
alt_unit_price);
showResult(result);
}
function
formatPrice(value)
{
var
result=
Math.floor(value)
+
".";
var
cents =
100
*
(value-Math.floor(value))
+
0.5;
result
+=
Math.floor(cents
/
10);
result
+=
Math.floor(cents
%
10);
return
result;
}
function
filterNonNumeric(field)
{
var
result =
new
String();
var
numbers =
"0123456789";
var
chars =
field.value.split("");
for
(i
=
0;
i <
chars.length;
i++)
{
if
(numbers.indexOf(chars[i])
!=
-1)
result +=
chars[i];
}
if
(field.value
!=
result)
field.value
=
result;
}
window.onload=findPrice;
</script>
<table
border="1"
cellspacing="0"
cellpadding="3"
width="300">
<tr>
<td>Single unit license</td>
<td
width=50
align=right>$19.95</td>
</tr>
<tr>
<td>License for 2 to 4 units</td>
<td
width=50
align=right>
$17.50</td>
</tr>
<tr>
<td>License for 5 to 9 units</td>
<td
width=50
align=right>$16.00</td>
</tr>
<tr>
<td>License for 10 to 24 units</td>
<td
width=50
align=right>
$13.00</td>
</tr>
<tr>
<td>License for 25 to 49 units</td>
<td
width=50
align=right>$10.00</td>
</tr>
<tr>
<td>License for 50 to 99 units</td>
<td
width=50
align=right>
$8.00</td>
</tr>
<tr>
<td>License for 100 to 199 units</td>
<td
width=50
align=right>
$6.00</td>
</tr>
<tr>
<td>License for 200 or more units</td>
<td
width=50
align=right>
$4.00</td>
</tr>
</table>
<br>
<form
name=calculator>
Units:
<input
type=text
value="1"
name="units"
onkeydown="findPrice()"
onKeyUp="filterNonNumeric(this);
findPrice()"
onkeypress="findPrice()"
size="4">
<input
type=text
onfocus="this.blur()"
name="respons"
size="24"
style="border:0;
font-weight:bold;">
</form>
|
↓ Bitcoin Dice - Crypto Casino . loansolo.com payday loans
|