Javascript基于类的继承

function parent()
{
    var id=1;
    var username="roboth";
    this.getID=function(){return id;}
    this.getUserName=function(){return username;}
}

function child()
{}

var child1=new child();
createInheritance(new parent(),child1);

function createInheritance(parent,child)
{
   var  pro;
   for (pro in parnet)
   {
       if(!child[pro])
       {
             child[pro]=parent[pro];
        }
  }
}



posted @ 2007-07-30 12:02 Robot·H 阅读(24) 评论(0)  编辑 收藏 所属分类: CSS+Javacript

标题  
姓名  
主页
Email (博主才能看到) 
验证码 *  看不清,换一张 [登录][注册]
内容(请不要发表任何与政治相关的内容)  
  登录  使用高级评论  新用户注册  返回页首  恢复上次提交      
"五向定位"职业成长路线公开课(上海、南京、大连)
Google站内搜索


相关链接: