Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3699352
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T05:05:33+00:00 2026-05-19T05:05:33+00:00

I have an object which creates a slideshow. I want to have several slideshows

  • 0
  1. I have an object which creates a slideshow.
  2. I want to have several slideshows on a page
  3. I have an event handler for slideshow element inside it
  4. I want the event handler to know which slideshow object has created an item clicked

–

slideshow=function(){

   var g = document.createElement(...);

   ...

   g.onclick = f1;

   f1 = function(slideshow_instance, event) {
      //EXPLAIN ME HOW TO GET THE slideshow_instance
   }

}

var sl1 = new slideshow();
var sl2 = new slideshow();

Clicking on an element slideshow has created should return either

sl1

or

sl2

I explain well?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T05:05:33+00:00Added an answer on May 19, 2026 at 5:05 am

    Short answer, use: this.

    Longer answer, what you want is:

    slideshow=function(){
       /* ... */
    
       var self = this;    
    
       f1 = function(event) {
          // do stuff with self.
       }
    
    }
    

    The reason you need to point to this using self is that event handlers will change the meaning of this when they are called. But at the time the object is created this properly refer to the correct object (an instance of slideshow). The reason we can access the self variable during event callback is because it has been captured by a closure.

    Feel free to google or search on stackoverflow any word/terminology from the above description if you need further explanation.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a form that has a button which creates a new object and
I have a class which creates a DOM element and has to capture all
I have a function which creates an object of values, but im getting this
I have created some python code which creates an object in a loop, and
I have a script which creates a user-defined object like this: obj = new
I have developed an application which creates an outlook application using outlook object model.
I have created a console test application which creates, an object & calls 2
I have a c# factory object which creates objects through factory methods, using a
I have an activity object, myAct. myAct creates and calls my httpGetter object which
I have the following class in C# which creates an object from a propriatery

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.