i) 存在一个与窗户交织的班子的问题,即有名称空间叫UTIL,而且有:
var UTIL = { Classes : {}};
UTIL.Classes.ObservationVal = function(state, id, type, context, performer, addresee, query) {
this.query = query;
SPEECH.Classes.ActionVal.call(this,state, id, type, context, performer, addresee);
}
UTIL.Classes.ObservationVal.prototype = new SPEECH.Classes.ActionVal();
UTIL.Classes.ObservationVal.prototype.constructor = SPEECH.Classes.ObservationVal;
after, i have this code:
var name = "ObservationVal";
var clStr = "UTIL.Classes." + name;
var obj = new window[clStr]();
最后一行显示了错误:“窗口不是构造者”
我不理解,为什么在从名称空间界定“观察”类别时,就没有客观。
function ObservationVal(state, id, type, context, performer, addresee, query) {
//..
}
the instanciate with window works ok. Thanks.