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

Works in IE but not Nescape

Status
Not open for further replies.

junai3

Programmer
May 6, 2004
3
0
0
US
I have this code I've written which works perfectly in Internet Explorer, but will not work in Netscape. I know Netscape requires better coding practices then IE, but I can't seem to figure out what's wrong with my code.

Here is my code:
-------------------------------------------------------

function TicketCost()
{
var CostPerTicket = 129;
var NumOfTickets;
var TotalCost;
var date;

NumOfTickets = Number(frmTickets.txtQuantity.value);

TotalCost = NumOfTickets * CostPerTicket;

var CostPerTicketChild = 89;
var NumOfTicketsChild;
var TotalCostChild;

NumOfTicketsChild = Number(frmTickets.txtQuantityChild.value);

TotalCostChild = NumOfTicketsChild * CostPerTicketChild;

frmTickets.txtCostTotal.value = TotalCostChild + TotalCost;

frmTickets.At_Least_1_Passenger.value = NumOfTickets + NumOfTicketsChild;

var Money = 10;
var discountPrice;
var Discount;
var subTotal;
var Passengers;
var noTax;
var Tax = 0.04166;
var withTax;
var result;

subTotal = Number(frmTickets.txtCostTotal.value);
Passengers = Number(frmTickets.At_Least_1_Passenger.value);
discountPrice = Passengers * Money;
Discount = subTotal - discountPrice;
withTax = Discount * Tax;
result=Math.round(withTax*100)/100;

PassengersM = Number(frmTickets.At_Least_1_Passenger.value);

frmTickets.txtDiscountTotal.value = Discount + result;
frmTickets.txtTaxTotal.value = result;
frmTickets.txtDiscountPrior.value = discountPrice;

}

-------------------------------------------------------

I call the code from a form where onChange and on Submit, it calls the function TicketCost(). Can anyone see what the problem is? I aprreciate the help.
 
whats it doing in netscape?...just not working at all, or partially working?

__________________________________________________________
"The only difference between me and a mad man is that I'm not mad."
- Dali
 

I imagine it is the reference to "frmTickets" that's doing it. You're not defining it anywhere. Try adding this to the top of your function:

var frmTickets = document.forms['frmTickets'];

Hope this helps,
Dan
 
To the very top of my function, I added:

var frmTickets = document.forms['frmTickets'];

and most everything worked! Thanks a bunch. I can't believe I missed that. I also found that I didn't define "At_Least_1_Passenger", so I added:

var At_Least_1_Passenger

and now everything works perfectly.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top