日期:2014-05-16  浏览次数:20428 次

为什么出现 is not a function?
function onlineChat(){}
onlineChat.prototype = {
control:null,
chatBox:"#chatContainers",
status:"max",
bar:new chatBar(),
historyBar:new chatBar(),
init:function(){
var o = this;
o.setup(); 
o.bar.barType = "main";
o.bar.maxBtn = "#"+o.control;
o.bar.minBtn = "#chatBoxMin";
o.bar.exitBtn = "#chatBoxExit";

o.bar.historyBar = "history";
o.historyBar.maxBtn = "#chatBoxHistoryBar > input";
o.historyBar.exitBtn = "#chatHistoryBar > input";

o.bar.eventHandler(); // 这里提示eventHandler is not a function()
o.historyBar.eventHandler();
},
  setup:function(){}
}
function chatBar(){} 
chatBar.prototype = {
barType:null,
title:null,
minBtn:null,
maxBtn:null,
exitBtn:null,
eventHandler:function(){alert("aaa");}
}


------解决方案--------------------
好像不会吧,莫非你把chatBar类定义到onlineChat后面了?定义到后面的话就出错。