Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Sep 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 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
    Senior Coder
    Join Date
    Feb 2003
    Posts
    1,665
    Thanks
    0
    Thanked 27 Times in 25 Posts
    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.

  • #3
    New to the CF scene
    Join Date
    Sep 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    well well well....this has certainly taught me to pay even more attention to detail. Thank you!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •