Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calculations in FrontPage 2003

Status
Not open for further replies.

julesNDC

IS-IT--Management
Dec 2, 2005
81
US
I have a form that I would like to calculate from fields. This is got to be a simple procedure but I tried using help to search for calucations and formulas and got no assistance.

Here's an example I would like

Field-1 is a drop down box with numbers
Field-2 is a drop down box with percentage number
Field-3 is the result of Field-1 + the percentage number

So if I pick 10 in Field-1 and 20% on Field-2 them Field-3 should show the result of the calculation as 12.
 
Will you be working in Javascript or VBScript
 
well... I don't know neither one but it if helps, a co-worker knows VBScript very well.
 
I put something together uaing javascrip but looks like I am missing something. Below is the entire HTML code for that page. thanks for your help.


<html>
<head><title>Bonus Calculator</title>
<meta name="description" content="Bonus calculator.">
<meta name="keyword" content="Bonus calculator">
<SCRIPT LANGUAGE="JavaScript">
//<!- hiding the code
function calculate(form){
var hourly;
var bonus;
var bonus1;
var bonus2;
var bonus3;

hourly=form.hourly.value;
bonus=form.bonus.value;
bonus1=2080*form.hourly.value*form.bonus.value/100;
bonus2=2080*form.hourly.value*0.2;
bonus3=2080*form.hourly.value*0.35;

}
// end hiding ->
</SCRIPT>

</head>
<body bgcolor=ffffff>
<center>
<p>
<font size=+2 face="arial,Helvetica" color=ff0000>Calculate Your Bonus</font><br><br>
<table width=632><tr><td>
Enter hourly rate
</td></tr></table><p>
<form name=form1>
<table border=4 width=751 height="116">
<tr><td>
<table border=0>
<tr><td align=right>Hourly Rate&nbsp;&nbsp; ($):</td><td align=left>
<input name=hourly value=10
size=8></td></tr>
<tr><td colspan=2 align=center>
<p align="right">Bonus&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
(%) <input name=bonus value=40 size=8></table>
<p><input type=button name="calc" value="Calculate Yearly Bonus" onClick="calculate(this.form)"></td>
<td>
<center><font size=+1 color=red>Results:</font></center>
<table border=0>
<tr><td align=right>Bonus for the Year with&nbsp; this Week Bonus as an average:</td><td align=left>
<input name=bonus1 value='' size=8></td></tr>
<tr><td align=right>Bonus for the Year with an average of 20%&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
:</td><td align=left><input name=bonus2 value='' size=8></td></tr>
<tr><td align=right>Bonus for the Year with an average of 35%&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
:</td><td align=left><input name=bonus3 value='' size=8></td></tr>
</table>
</td></tr></table>

</center>
</body>
</html>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top