...

View Full Version : how to access parent functions variables



jayapalchandran
07-05-2010, 09:14 AM
function note(x,y,who)
{
this.x = x
this.y = y
this.who = who
this.timeout = null
}

note.prototype.show()
{
$('#notex').fadeIn(200, function() { alert(this.x); }
this.timeout = SetTimtout( function() { alert(this.who); } );
}

var sa = new note(50,50,'notex')

sa.show();

I am trying to create a simple class in which i want to sent the id of a div to fade in and fade out...
so that i can dynamically change its color width and height with a basic class.

I read about closures but inside jquery this is referring the div notex....

how to access parent functions variables?

_Aerospace_Eng_
07-05-2010, 09:37 AM
You spelled settimeout wrong and you never close your fadeIn call. Simple javascript debugging will catch this.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum