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 6951419
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T14:13:03+00:00 2026-05-27T14:13:03+00:00

I need this structure to organize my code…so that I can call it like

  • 0

I need this structure to organize my code…so that I can call it like this

Control.Menu

Here is my attempt:

var Control = 
{
    Menu : menu  
    {
        menu_timer:     0,
        menu_element:   0,

        top_mouse_over: function ( id ) 
        {
            Menu.bottom_mouse_over();
            Menu.menu_element = document.getElementById( id );
            Menu.menu_element.style.visibility = 'visible';
        },
...
    }
};
  • 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-27T14:13:04+00:00Added an answer on May 27, 2026 at 2:13 pm

    This is your problem:

    Menu : menu  
    {
        …
    

    What’s the menu on the right side of the colon for? All you need is this:

    Menu: {
        …
    

    Inside top_mouse_over(), Menu won’t be defined:

    Menu.bottom_mouse_over(); // This isn’t going to work
    

    …it was just a property on the Control object; you never created a Menu variable anywhere. Instead, you can refer to it as Control.Menu, or use the this keyword. In a function, this is whatever object the function was called as a property of, i.e. the thing to the left of the dot. In this case, if you call it like this:

    Control.Menu.top_mouse_over(someId);
    

    …then inside top_mouse_over, this will point to Menu. You could change the body of the function to this:

    top_mouse_over: function ( id ) 
    {
        this.bottom_mouse_over();
        this.menu_element = document.getElementById( id );
        this.menu_element.style.visibility = 'visible';
    }
    

    (If you’re not familiar with this, please read up on it before you use it. Until you understand it, it will be easy to make mistakes.)

    FWIW, common convention is to capitalize only constructors (functions you call with the new keyword), and to start anything else with a lowercase letter.

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

Sidebar

Related Questions

i need a structure like this array(){ [0] => array(){ [0] => array(){ //
I have a structure like this.... UITableViewController -> UITableViewCell -> UIView I need the
I'm building an application and need a data structure of interconnected objects that can
I need to transform my nested sets structure (mysql) into json for this spacetree
I don't need this declaration because it only makes my code big and unreadable.
I have an app (cms) which structure is like this: BASE: /application/ /public/ themes/
I have a dynamic layout with this structure. With this structure I need to
I need this for some animation effects and i remember there is a window
I need this for calling a C function from Java class (JNI) and I
I need this because the constructor in the superclass is calling a method which

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.