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>
<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>