Javascript 对象继承

<html>
<head>
<title></title>
</head>
<body>
<script language=javascript >
   
function user()
   {
       this.name
="";
       this.showName
=function(){alert(this.name);};
   }
   
function teacher(name)
   {
        user.call(this);
   }
   var  my 
= new teacher();
   my.name 
= "jc" ;
   my.showName(); 

 
 
</script>


</body>
</html>
posted on 2007-02-03 08:57  jinchun  阅读(251)  评论(0编辑  收藏  举报