troubleshooting Question

Javascript function scope problem...

Avatar of alborach
alborach asked on
JavaScript
5 Comments1 Solution347 ViewsLast Modified:
I have the following code of javascript to cal a function of a component. Th problem is that when I tried to access the public function through the call: GUI_MiniCalendar.component.test() or GUI_MiniCalendar.component.viewCalendar() the functions are executed in firefox without problems, but in google chrome, ie and opera the functions aren't executed at all. What I'm doing wrong?


Ext.onReady(function() {

 Ext.namespace('GUI_MiniCalendar');

 GUI_MiniCalendar.component = function() {

 /**
 * Private Methods
 */
 function viewCalendar(month,year,evt)
 {
    alert('view calendar');
 }

 /**
 * Public methods
 */
 return {

  viewCalendar: function(month, year, evt)
  {
    viewCalendar(month, year, evt);
  },

  test: function()
  {
    alert('testing!');
  }

 }; // return

}();

 GUI_MiniCalendar.component.test();

});
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 5 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros