Reply to Re: JavaScript Help: Cost Savings Calculator

Your name:

Reply:


Posted by Adam Pflug on 10/01/05 13:08

Here:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<title>Untitled Document</title>

<script type="text/javascript">
<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->
<!-- Created by: www.jdstiles.com -->
<!-- Begin
function startCalc(){
interval = setInterval("calc()",1);
}
function calc(){
one = document.getElementById("firstBox").value;
two = document.getElementById("secondBox").value;
three = document.getElementById("thirdBox").value;
four = document.getElementById("fourthBox").value;
five = document.getElementById("fifthBox").value;
six = document.getElementById("sixthBox").value;
document.getElementById("seventhBox").value = (one * 1) + (two * 1) +
(three * 1) + (four * 1) + (five * 1) + (six * 1);
if (document.getElementById("servicefee1").checked)
fee = document.getElementById("servicefee1").value;
else if (document.getElementById("servicefee2").checked)
fee = document.getElementById("servicefee2").value;
else if (document.getElementById("servicefee3").checked)
fee = document.getElementById("servicefee3").value;
else if (document.getElementById("servicefee4").checked)
fee = document.getElementById("servicefee4").value;
else if (document.getElementById("servicefee5").checked)
fee = document.getElementById("servicefee5").value;
document.getElementById("TotalServiceFee").value = fee;
document.getElementById("TotalMonthlySavings").value =
document.getElementById("seventhBox").value + fee;
document.getElementById("TotalYearlySavings").value =
Math.round((document.getElementById("seventhBox").value + fee) * 12 *
100) / 100;
}
function stopCalc(){
clearInterval(interval);
}
// End -->
</script>
<style type="text/css">
<!--
..style1 {font-family: Arial, Helvetica, sans-serif}
..style2 {
font-family: Arial, Helvetica, sans-serif;
font-size: 14px;
background-color: #CCCCCC;
font-weight: bold;
}
..style4 {font-family: Arial, Helvetica, sans-serif; font-weight: bold;
}
..style6 {
font-family: Arial, Helvetica, sans-serif;
color: #666666;
font-weight: bold;
}
-->
</style>
</head>

<body>

<form name="autoSumForm">
<p class="style2">Step One: Total Monthly Personal Costs </p>
<table width="50%" cellpadding="2" cellspacing="3" >
<tr>
<td width="53%" class="style1">Personal Monthly Cost One </td>
<td width="47%"><input type=text id="firstBox" name="firstBox"
value="" onFocus="startCalc();" onBlur="stopCalc();"></td>
</tr>
<tr>
<td class="style1">Personal Monthly Cost Two </td>
<td><input type=text id="secondBox" name="secondBox" value=""
onFocus="startCalc();" onBlur="stopCalc();"></td>
</tr>
<tr>
<td class="style1">Personal Monthly Cost Three </td>
<td><input type=text id="thirdBox" name="thirdBox" value=""
onFocus="startCalc();" onBlur="stopCalc();"></td>
</tr>
<tr>
<td class="style1">Personal Monthly Cost Four </td>
<td><input type=text id="fourthBox" name="fourthBox" value=""
onFocus="startCalc();" onBlur="stopCalc();"></td>
</tr>
<tr>
<td class="style1">Personal Monthly Cost Five </td>
<td><input type=text id="fifthBox" name="fifthBox" value=""
onFocus="startCalc();" onBlur="stopCalc();"></td>
</tr>
<tr>
<td class="style1">Personal Monthly Cost Six </td>
<td><input type=text id="sixthBox" name="sixthBox" value=""
onFocus="startCalc();" onBlur="stopCalc();"></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</table>
<p class="style2">Step Two: Select Monthly Service Fees</p>
<span class="style6">The user will select a &quot;Service Fee&quot;
and the selection will appear in the &quot;Total Service Fee Cost&quot;
below.
</span>
<table width="50%" cellpadding="2" cellspacing="3" >
<tr>
<td width="40%" class="style1">Select Service Fee 1 </td>
<td width="60%"><input name="radiobutton" id="servicefee1"
type="radio" onchange="calc()" value="155.95" checked>
$150.95</td>
</tr>
<tr>
<td class="style1">Select Service Fee 2 </td>
<td><input name="radiobutton" id="servicefee2" type="radio"
onchange="calc()" value="160.95">
$160.95</td>
</tr>
<tr>
<td class="style1">Select Service Fee 3 </td>
<td><input name="radiobutton" id="servicefee3" type="radio"
onchange="calc()" value="180.95">
$180.95</td>
</tr>
<tr>
<td class="style1">Select Service Fee 4 </td>
<td><input name="radiobutton" id="servicefee4" type="radio"
onchange="calc()" value="190.95">
$190.95</td>
</tr>
<tr>
<td class="style1">Select Service Fee 5 </td>
<td><input name="radiobutton" id="servicefee5" type="radio"
onchange="calc()" value="200.95">
$200.95</td>
</tr>
</table>
<br>
<table width="50%" cellpadding="2" cellspacing="3" >
<tr bgcolor="#EBEBEB">
<td width="53%" class="style4">Total Personal Costs </td>
<td width="47%"><input type=text id="seventhBox"
name="seventhBox" > </td>
</tr>
<tr bgcolor="ebebeb">
<td class="style4">Total Service Fee Cost </td>
<td><input name="TotalServiceFee" type=text id="TotalServiceFee"
> </td>
</tr>
<tr bgcolor="ebebeb">
<td class="style4">Total Monthly Savings </td>
<td><input name="TotalMonthlySavings" type=text
id="TotalMonthlySavings" ></td>
</tr>
<tr bgcolor="ebebeb">
<td class="style4">Total Yearly Savings </td>
<td><input name="TotalYearlySavings" type=text
id="TotalYearlySavings" ></td>
</tr>
</table>
<br>
<br>
<br>
<p class="style6">How can I get the script to calculate Total yearly
savings?</p>
<p class="style6">Here's the equation.</p>
<table width="230" height="74" border="1" bgcolor="efefef">
<tr>
<td align="right" valign="top"><p class="style1">Total Personal
Costs<br>
-Total Service Fee Cost<br>
-----------------------------<br>
= Total Monthly Savings<br>
x 12 Total Yearly Savings
</p>
</td>
</tr>
</table>
<p>&nbsp; </p>
<p> <br>
</p>
</form>

</body>
</html>

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация