[thelist] [JavaScript] nesting functions - am I missing something?

VOLKAN ÖZÇELİK volkan.ozcelik at gmail.com
Wed May 18 05:25:42 CDT 2005


I think you have to assign the nested function as a member variable with 
this.bar = fn(), var bar = fn() or foo.prototype.bar = fn etc.

the script below works:
 
<script>
function foo()
{
	this.bar = function()
	{
	    alert('baz');
	}
}

new foo().bar();
</script>

HTH,
Volkan.


On 5/18/05, Christian Heilmann <codepo8 at gmail.com> wrote:
>                function foo()
>                {
>                        function bar()
>                        {
>                                alert('baz');
>                        }
>                }
> 
> On Firefox. foo.bar(); will alert, on MSIE and opera is doesn't. Is
> there something I am missing?
> 
> --
> Chris Heilmann
> Blog: http://www.wait-till-i.com
> Writing: http://icant.co.uk/
> Binaries: http://www.onlinetools.org/
> --
> 
> * * Please support the community that supports you.  * *
> http://evolt.org/help_support_evolt/
> 
> For unsubscribe and other options, including the Tip Harvester
> and archives of thelist go to: http://lists.evolt.org
> Workers of the Web, evolt !
>


More information about the thelist mailing list