//方式一
function superClass()
{
this.name = "hi";
this.showName = function() {window.alert(this.name)};
}
function childClass()
{
}
childClass.prototype = new superClass();
var c = new childClass();
c.showName();
//方式二
var superClass = {name:"hi", showName:function() {window.alert(this.name)}};
function childClass()
{
}
childClass.prototype = superClass;
var c = new childClass();
c.showName();