Avatar of gouder
gouder
 asked on

HTML Custom Calculator

I am looking for an alternative way to code the following:

<script type="text/javascript">// <![CDATA[
 hide this script from old browsers
function temp(form)
{
  var f = parseFloat(form.DegF.value, 10);
	var g = parseFloat(form.DegG.value, 10);
	var h = parseFloat(form.DegH.value, 10);
  var c = 0;
	  c = (f * 2)+ (g * 4);
  form.DegC.value = c;
	var d = 0;
	  d = ((h * .02) * 12) + (c * 12) ;
  form.DegD.value = d;
}
<!-- done hiding from old browsers
// ]]></script>
<form>
<h2>What Is Your Estimated Rewards Value With FTR?</h2>
Enter how many people you are connected to on Facebook, Twitter, Email, Etc: <input type="text" name="DegF" value="0" size="15" maxlength="15" /> 
<br /> 
Enter how many businesses you are connected to on LinkedIn, Email, Etc: <input type="text" name="DegG" value="0" size="15" maxlength="15" /> 
<br /> 
nter how many times you share comments, pictures, videos, etc with your networks every month: <input type="text" name="DegH" value="0" size="15" maxlength="15" /> 
<br /> 
<p>
Click this button to calculate Your Rewards: <INPUT NAME="calc" VALUE="Calculate" TYPE=BUTTON onClick=temp(this.form)>
<p>
 <br /> Your Estimate Monthly Rewards Would Be $ <input type="text" name="DegC" readonly="readonly" size="15" /> <br /> Your Estimate Annual Rewards Would Be $ <input type="text" name="DegD" readonly="readonly" size="15" /></form>

Open in new window


We were able to imbed the previous code into our system however it would only work on Firefox. After testing out other formats for calculators, we found only on will work on our system. Example:

<form>
<input type=text name=userinput>
<input type=button
onKeyPress="if(document.all){var k=event.keyCode;}else{var k=event.which;}if(!(k>=48&&k<=57)){return false;}"
onClick="var saved=(15-8)*this.form.userinput.value;alert('You saved '+saved);">
</form> 

Open in new window


We need the first code to be converted to the code just about with out the pop up window for results.

Any suggestions?
Scripting LanguagesWeb Languages and Standards

Avatar of undefined
Last Comment
Michel Plungjan

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Michel Plungjan

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
gouder

ASKER
Oh wow.... Thank you, thank you, thank you! I just tested it out and it is working with Firefox, Explorer, and Chrome.
gouder

ASKER
I can't express my gratitude for fixing my errors. I have spent over 40 hours of researching alternative codes and mplungjan saved the day, more like the month!
Michel Plungjan

Thanks for the kind words

glad to have been of service
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy