对象的继承
六月初六 2004-02-12 10:07:59 在JSCRIPT里我有一个对象
function chtml(wname)
{
this.hname = wname
this.text = new Array()
....
....
....
}
我另写了一个类
function htmla()
{
this.value = ....
...
...
}
以及
function htmlfont()
{
this.value = ....
...
...
}
并且这两个对象继承基类chtml()
htmlfont.prototype = new chtml("font")
htmla.prototype = new chtml("a")
在使用时出了这样一个问题希望解决
我是这样用的
var a
a = new htmla()
a.text[0] = new htmlfont()
a.text[0].text[0] = "ttt"
a.text[0].text[1] = "qqq"
但结果显示这两个值都为“qqq”
不嵌套对象附值没有问题
请教
(请对问题本身做评价 谢谢)