calling a function, how?

bunch of If statements then calls a function within a function inbetwe

Page 1 of 1

1 Replies - 695 Views - Last Post: 29 January 2009 - 06:42 AM

#1 XMEGA  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 135
  • Joined: 17-November 08

calling a function, how?

Post icon  Posted 28 January 2009 - 11:59 PM

well I have a workin function but would like to add it my existing code function however when trying to apply that it breaks...so if there a way I could just call the already existing function that works fine by itself? kinda like this

function mainFuntion()
		if (document.form.blah.value == "")
		  {
			if (message == "")
			{
				document.form.blah.focus ();
			}
			message += "blah is required.\n";
		}

//--> call  otherFunction() here?

		if (message != "")
		{
			alert(message);
			return false;
		}
		else
		{
			return true;
		}
	}

function otherFuntion()
{
//stuff that works already
}




thanks in advance...

Is This A Good Question/Topic? 0
  • +

Replies To: calling a function, how?

#2 BetaWar  Icon User is offline

  • #include "soul.h"
  • member icon

Reputation: 1509
  • View blog
  • Posts: 8,273
  • Joined: 07-September 06

Re: calling a function, how?

Posted 29 January 2009 - 06:42 AM

Yes, you can call a function from a function. I think your only problem is that your mainFunction() has no opening brace.

Add this:
{


to the end of this:
function mainFunction()


And I believe it should work.

HTH
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1