我有這樣的類/函數如何從方法的函數內訪問原型的父這個
function Menu()
{
this.closetimer = 0;
this.dropdown = 0;
}
Menu.prototype.menuTimer = function()
{
this.closetimer = setTimeout(function()
{
this.menuClose();
}, this.timeout);
}
Menu.prototype.menuClose = function()
{
if(this.dropdown) this.dropdown.css('visibility','hidden');
}
我要調用的函數menuClose()
這是Menu類的一部分,但我覺得這個代碼實際上是嘗試從closetimer
對象中調用menuClose()
。
如何從menuTimer()
的Menu對象中引用menuClose()
?
衛生署!謝謝!腦屁。 – polyhedron 2010-11-01 20:35:15
@ polyhedron - welcome :) – 2010-11-01 20:36:10