function Parent() {
this.Method = function() {
alert("Parent Method");
};
}; function Son() {
Parent.call(this); this.Method = function() {
alert("Son Method");
(new Parent()).Method.call(this);
};
}; function Grandson() {
Son.call(this);
this.Method = function(){
alert("Grandson Method");
(new Son()).Method.call(this);
};
};
调用 Son的method是成功的,
var s = new Son();
s.Method();
调用 Grandson的Method的失败,
var g = new Grandson();
g.Method();
this.Method = function() {
alert("Parent Method");
};
}; function Son() {
Parent.call(this); this.Method = function() {
alert("Son Method");
(new Parent()).Method.call(this);
};
}; function Grandson() {
Son.call(this);
this.Method = function(){
alert("Grandson Method");
(new Son()).Method.call(this);
};
};
调用 Son的method是成功的,
var s = new Son();
s.Method();
调用 Grandson的Method的失败,
var g = new Grandson();
g.Method();
解决方案 »
- 麻烦大家帮忙看下为什么ie下不兼容
- div不同区域点击时弹出窗口的怪问题,高手请解答!
- 如何使函数有时候无效,有时候有效
- ~~~~~~如何提取视频网站中,网页里面的视频的地址???
- 请问meizz:"梅花雨日历控件2.02版"可不可以在IE以外的浏览器的?
- 求不出现任何提示,2秒后自动关闭窗口的代码!
- javascript执行外部程序的问题,比较有趣,谁来试试?
- 一个列表框,里面是文件的名字,怎么样一点一个项,就打开一个相应网页呀。必给分!!!!!
- RegExp函数是什么意思,主要做什么用的?请指教,急!!!
- 新手求助~~js如何获取另一个网页的多个变量值
- js跳转到页面指定位置(不能用锚点方法)
- call实现override函数的调用问题
this.GetLength = function() {
return 1;
};
}; function Son() {
Parent.call(this); this.Method = function() {
(new Parent()).Method.call(this) + 1;
Uncaught TypeError: Cannot call method 'call' of undefined
};
}; function Grandson() {
Son.call(this);
this.Method = function(){
(new Son()).Method.call(this) + 1;
};
};
var s = new Son();
s.Method(); var g = new Grandson();
g.Method();