Web Analytics Made Easy -
StatCounter function expected; logical error? - CodingForum

Announcement

Collapse
No announcement yet.

function expected; logical error?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • function expected; logical error?

    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.
    Code:
    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.
    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

  • #2
    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.
    Why you should validate your code before asking for help...

    Comment


    • #3
      well well well....this has certainly taught me to pay even more attention to detail. Thank you!

      Comment

      Working...
      X