0
我有一个自我调用功能。有可能在某处调用自调用函数方法吗?
var controller = new (function() {
this.func = function {
};
});
这个get在第一页上执行,我想访问我的另一个页面中的函数。我如何才能访问该方法...
我有一个自我调用功能。有可能在某处调用自调用函数方法吗?
var controller = new (function() {
this.func = function {
};
});
这个get在第一页上执行,我想访问我的另一个页面中的函数。我如何才能访问该方法...
var controller = new (function _controller() {
this.func = function {
};
});
var otherController = new _controller();
您的JavaScript代码需要包含在每个需要使用它的单独页面中。通过该方法“”假设你的意思是“FUNC()”的“控制器”的构造函数定义的函数,你必须实例化一个对象,然后通过它拨打:
var myController = new controller();
myController.func();
作为常用功能存储在js文件中并链接到文件中 – Pratik 2011-06-17 11:45:33