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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T06:01:01+00:00 2026-05-27T06:01:01+00:00

This must be a very stupid question, but I just can’t get it to

  • 0

This must be a very stupid question, but I just can’t get it to work.

I’m creating my own UIKit for iOS. (Website-kit which will allow iPhone-like interfaces).

But, I’m trying to create a JavaScript library, which can be used to change several elements of the document. For instance, set a custom background colour when the document loads.

I’m trying to do that with object-orientated JavaScript. Like this:

var UI = new Interface();
UI.setBackground("#000");

How could I achieve this?
(So the custom “UI” Object, and (an example) on how to change the background color of the document, from INSIDE the object.)

  • 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-27T06:01:02+00:00Added an answer on May 27, 2026 at 6:01 am

    You can save a reference to the DOM inside the JS object and rewrite it as needed.

    function Interface() {
        this.setBackground = function (color) {
            this.pointTo.style.background = color;
        };
        this.pointTo = document.body;
    }
    

    You can initialize this by:

    var UI = new Interface();
    UI.pointTo = document.getElementById('some_id');
    UI.setBackground("#000");
    // Set another style, on a different element
    UI.pointTo = document.getElementById('some_other_id');
    UI.setBackground("#FFF");
    

    This is a simple implementation and need to be allot smarter, but it should do the job.

    Edit:
    Made a mistake in original posting, and fixed erroneous code. Also made an example: http://jsfiddle.net/HpW3E/

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

Sidebar

Related Questions

This must be a very stupid question, but how does one recode with Xuggler?
This must be a really stupid question, but I'm still very green when it
This must be a very stupid newbie question, but I have spent my whole
This must be a very simple question, but I don't seem to be able
I must be missing something very simple, but can't find the answer to this.
This must be a stupid question, but nevertheless I find it curious: Say I
this is a really stupid question but I have a deadline and I'm very
This might be a very stupid question, but I have to ask it anyway.
I feel stupid asking this question, but I can not find a clear answer
This is my first time drawing, so it must be something very stupid, but

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.