你应该问一下JS里继承如何实现就行了.
<script>
function class1(f1, f2) //类1
{
this.field1 = f1
this.field2 = f2
this.fund1 = function (a) {
alert('class1\'s func1');
}
}function class2(a, b) //类2继承自类1
{
var f = new class1(a, b);
return f;
}var c = new class2('b1', 'c1'); //创建类2的对像
alert(c.field1);
c.fund1();
</script>
<script>
function class1(f1, f2) //类1
{
this.field1 = f1
this.field2 = f2
this.fund1 = function (a) {
alert('class1\'s func1');
}
}function class2(a, b) //类2继承自类1
{
var f = new class1(a, b);
return f;
}var c = new class2('b1', 'c1'); //创建类2的对像
alert(c.field1);
c.fund1();
</script>
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货