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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

simple script working with IE, but not with firefox

Status
Not open for further replies.

photoxprt1868

Programmer
Jul 22, 2005
76
0
0
US
Hello,

Does anybody have an idea why this script is not working in fireFox. It works perfectly in IE

Here's the script

Code:
<SCRIPT LANGUAGE="JavaScript">

function calculateCost(kwh){
var custCharge2005 = 5.25;

var first750kwh = 0.04302;
var first750 = 0;
var over750kwh = 0.05232;
var over750 = 0;
var fuelCharge = 0.04009;

var custCharge2006 = 5.17;
var first1000kwh = 0.04231;
var first1000 = 0;
var over1000kwh = 0.05231;
var over1000 = 0;
var fuel1st1000kwh = 0.0584;
var fuelOver1000kwh = 0.06841;


if (kwh > 750){
	first750 = 750;
	}
	else{
		first750 = kwh;
	}

if (first750 < kwh){
	over750 = kwh - first750;
	}
	else{
		over750 = 0;
	}

var cost2005 = custCharge2005 + (first750kwh * first750) + (over750kwh * over750) + (fuelCharge * kwh) - 1.36;
<!--1.36 is the gross reciept tax -->

if (kwh > 1000){
	first1000 = 1000;
	}
	else{
		first1000 = kwh;
	}

over1000 = kwh - first1000;

var cost2006 = custCharge2006 + (first1000kwh * first1000) + (over1000kwh * over1000) + (fuel1st1000kwh * first1000) + (fuelOver1000kwh * over1000);

//alert(cost2005);
//alert(cost2006);
compareForm.charge2005.value = cost2005;
compareForm.charge2006.value = cost2006;
}
</script>

and this is how I call it

Code:
<img onClick="calculateCost(compareForm.kwh.value);" src="images/blubvtop.gif" width="68" height="20">

Thank you
 
Try using document.compareForm.... when you access the form elements.

Lee
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top