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

  • Home
  • SEARCH
  • 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 8013643
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T19:41:15+00:00 2026-06-04T19:41:15+00:00

I call the object methods below like this. new Cout( elem1 ).load( ‘body’ )

  • 0

I call the object methods below like this.

new Cout( elem1 ).load( 'body' )

new COut( elem1 ).display( 'email' )

I only use one instance at a time. Because I only use one instance at a time, I want to remove this.element and use the passed in element instead.

This got me to wondering is the passed in element static or instance based. I think it might be this.element ( instance based )…even when I don’t explicitly state it. I plan on removing all mentions of this.element for just element.

Is it?

Note: this is returned implicitly if no other return is given.

var COut = function ( element ) 
{
    var messages = 
    {
        name:         'Please enter a valid name',
        email:        'Please enter a valid email',
        email_s:      'Please enter a valid email.',
        pass:         'Please enter password, 6-40 characters',
        url:          'Please enter a valid url',
        title:        'Please enter a valid title',
        tweet:        'Please enter a valid tweet',
        empty:        'Please complete all fields',
        same:         'Please make emails equal',
        taken:        'Sorry, that email is taken',
        validate:     'Please contact <a class="d" href="mailto:fo@foo.com">support</a> to reset your password'
    };
    this.element = element;
    this.display = function( type ) 
    {
        this.element.innerHTML = messages[ type ];
    };
    this.load = function( location )
    {
        new AjaxRequest().invoke( 'ajax_type=async_load', function( response_text )
        {
            document[location].innerHTML = response_text;  
            new Cin().init( response_text.charAt( 6 ) ); // Correlate this point to Ajax Call.
        } ); 
    };
};
  • 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-06-04T19:41:17+00:00Added an answer on June 4, 2026 at 7:41 pm

    element isn’t really either. It’s a local variable to the constructor that will be defined per call. It’s only a property of this because it’s been set explicitly:

    var COut = function ( element ) 
    {
        // ...
        this.element = element;
        // ...
    };
    

    Still, using it rather than this.element should work fine with any function/method defined within the constructor:

    var COut = function ( element ) 
    {
        // ...
        this.display = function( type ) 
        {
            element.innerHTML = messages[ type ];
        };
        // ...
    };
    

    Where it won’t be accessible is if you instead used the prototype to define methods outside of the constructor. Here, element wouldn’t be in scope; but this would be, so this.element would be as well:

    COut.prototype.display = function ( type ) {
         this.element.innerHTML = messages[ type ];
    
         element.innerHTML = messages[ type ]; // ERROR: `element` is not defined
    };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Below I call the same methods in author and w5 model objects. But one
I'm using Smarty templates which call object methods. I've put the code on a
I'm trying to override methods of an object but still call the prototype's original
For executing array methods on NodeList objects(Array like) we need to make indirect call
I have code like this: // Create event handler delegate symbolReader.ReadNotify += new EventHandler(symbolReader_ReadNotify);
I'm trying to write a simple object to Dictionary converter like below: public static
Can I dynamically call an object method having the method name as a string?
How do I call an object's method from EL? Give the object: public class
How can I call methods from an array of objects (that hold an array
What happens when you call notifyAll method on an object that is not waiting?

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.