Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Jan 2007
    Location
    Chennai, Tamil Nadu, India
    Posts
    71
    Thanks
    5
    Thanked 0 Times in 0 Posts

    how to access parent functions variables

    Code:
    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?
    http://vikku.info/
    - யானைக்கும் அடிசறுக்கும்

  • #2
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    You spelled settimeout wrong and you never close your fadeIn call. Simple javascript debugging will catch this.
    ||||If you are getting paid to do a job, don't ask for help on it!||||


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •