...

View Full Version : function expected; logical error?



dezpig
09-25-2006, 10:36 AM
Hi all.

Ive been having trouble debugging a javascript application ive been righting and ive hit a big stumbling block (yes only in the past 2 hours, ive hit 5 of littler errors).

It is a "function expected" error which ive gone through the offending function and found there to be no errors. but still debugging using internet explorer, it persists to say there is a function expected.

I was wondering if someone could do a good favour and locate the error and suggest a correction.

Thanks

Here is the Main function.

function main()
{
getdetail();

if((firstname=="")||(surname=="")||(address=="")||(suburb=="")||(state=="")||(dest=="")||(aclass=="")||(hotel=="")||(nights==""))
{
alert("Please enter all details");
}
else
{
flightdetail();
hotel();
/* if((document.details.car[0].checked==true)
{
cyes=true;
CarTotal=carhire();
}
else
{
cyes=false;
CarTotal=0;
}
*/
display();
}
}


Here is the offending code.

function hotel()
{
var acost;

if(hotel=="standard")
acost=110*nights;
if(hotel=="deluxe")
acost=140*nights;
if(hotel=="prestige")
acost=190*nights;
}

If other sections of the code are required i will post them.


Thanks
,Derek

Bill Posters
09-25-2006, 11:12 AM
It may well be due to your duplicate use of hotel as both a function name and a variable name.
Change one of them to something else and see if that sorts it.

dezpig
09-25-2006, 11:26 AM
well well well....this has certainly taught me to pay even more attention to detail. Thank you!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum