日期:2014-05-16 浏览次数:20416 次
function eventManage()
{
    this.eventList={};
}
eventManage.prototype={
  //创建一个constructor指向
  constructor:eventManage,
  
  //保存事件
  addEvent:function(ev,fn)
  {},
  
  //触发事件
  startEvent:function(ev)
  {},  
  
  //清除事件
  removeEvent:function(ev,fn)
  {}                
}
function Prototype(obj)
{
    function F(){}    //创建一个临时原型
    F.prototype=obj;    //继承传入对象的属性和方法
    return new F;    //返回一个构造函数
}
//创建超类型副本
function inPrototype(obj1,obj2)
{
    var pro=Prototype(obj1.prototype);    //创建超类型的副本对象
    pro.cunstructor=obj2;    //给副本对象增加一个constructor属性
    obj2.prototype=pro;    //把对象副本赋值给子类型
}
function oDemo(name)
{
    eventManage.call(this);
    this.name=name;
}
inPrototype(oDemo,eventManage);
oDemo.prototype.say=function(say)
{
}
function oDemo2(ev)
{
}
var a=new oDemo('abc');
a.addEvent('a',oDemo2);    //这个地方报错,错在哪里?
a.say('着火了');