View Full Version : 'return' Statement Outside of Function?? Help

01-30-2007, 10:46 PM
I'm new to javascript and am getting an error "'return' statement outside of function" Line 79 Char 13"

I go to that line in my code and am not seeing the problem. I must be over looking something simple. If someone can view source on my page and let me know that they think that'd be great!!! Thanks

My page with the problem is:


01-30-2007, 10:58 PM
This is a function (they can look various ways but, most are something like so:

function doSomething(){
stuff to do here

You cannot use:


outside one of those. For example, some regular code outside of a function:

var blah=10
var bleh=1
return //<--can't do this.

You can only return from a function. If it is nested, you return to the parent function. If it isn't nested, you return to the global object. If you are already at the global object, there is nowhere to return to.

01-30-2007, 11:00 PM
This looks to be the problem:

<!--function loadPage()
return true;

Get rid of the red parts.

01-30-2007, 11:24 PM
Thanks for your help John. I had a feeling that part didn't look right but didn't know for sure. I'll try it now. Thanks again.