alert(objA.showColor());
alert(objB.showColor());
alert(objB.showName());
改成
objA.showColor();
objB.showColor();
objB.showName();再试试
alert(objB.showColor());
alert(objB.showName());
改成
objA.showColor();
objB.showColor();
objB.showName();再试试
解决方案 »
- extjs 如何根据json返回的值 来更新进度条。
- ajax象servlet传值,提示字符串未定义!!!!求大神现身!!
- window.parent fckeditor access denied——很郁闷的问题
- 求,最好的JavaScript编辑器
- 看看这个奇怪的问题。。。
- 在51forbes树中,怎么样才能获得选中的checkbox
- top.close();和history.back();是什么意思。
- 网络游戏公司急招网站开发人员!!!
- window.open 的问题(急!!)
- 请问:如何用JS实现ie地址栏组合录入框的功能?
- 如何随机显示图片位置
- 点击按钮选择要插入的图片,并且显示图片
//父类
function ClassA(sColor) {
this.color = sColor;
this.showColor = function() {
alert(this.color);
};
}
function ClassB(sColor, sName) {
//this.newMethod = ClassA;
//this.newMethod(sColor);
//delete this.newMethod;
//ClassA.call(this, sColor);
ClassA.apply(this, new Array(sColor));
//创建新属性和方法
this.name = sName;
this.showName = function() {
alert(this.name);
};
}
// test
var objA = new ClassA("blue");
var objB = new ClassB("red", "apq");
objA.showColor();//不是继承的问题 而是人方法里已经alert了 你又alert
objB.showColor();
objB.showName();
</script>
"alert()的返回值为undefined" 学习了...
我最近都alert 迷糊了